org.bouncycastle.asn1.bc.EncryptedObjectStoreData Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of bc-fips Show documentation
Show all versions of bc-fips Show documentation
The FIPS 140-3 Bouncy Castle Crypto package is a Java implementation of cryptographic algorithms certified to FIPS 140-3 level 1. This jar contains JCE provider and low-level API for the BC-FJA version 2.0.0, FIPS Certificate #4743. Please see certificate for certified platform details.
/***************************************************************/
/****** DO NOT EDIT THIS CLASS bc-java SOURCE FILE ******/
/***************************************************************/
package org.bouncycastle.asn1.bc;
import org.bouncycastle.asn1.ASN1EncodableVector;
import org.bouncycastle.asn1.ASN1Object;
import org.bouncycastle.asn1.ASN1OctetString;
import org.bouncycastle.asn1.ASN1Primitive;
import org.bouncycastle.asn1.ASN1Sequence;
import org.bouncycastle.asn1.DEROctetString;
import org.bouncycastle.asn1.DERSequence;
import org.bouncycastle.asn1.x509.AlgorithmIdentifier;
/**
*
* EncryptedObjectStoreData ::= SEQUENCE {
* encryptionAlgorithm AlgorithmIdentifier
* encryptedContent OCTET STRING
* }
*
*/
public class EncryptedObjectStoreData
extends ASN1Object
{
private final AlgorithmIdentifier encryptionAlgorithm;
private final ASN1OctetString encryptedContent;
public EncryptedObjectStoreData(AlgorithmIdentifier encryptionAlgorithm, byte[] encryptedContent)
{
this.encryptionAlgorithm = encryptionAlgorithm;
this.encryptedContent = new DEROctetString(encryptedContent);
}
private EncryptedObjectStoreData(ASN1Sequence seq)
{
this.encryptionAlgorithm = AlgorithmIdentifier.getInstance(seq.getObjectAt(0));
this.encryptedContent = ASN1OctetString.getInstance(seq.getObjectAt(1));
}
public static EncryptedObjectStoreData getInstance(Object o)
{
if (o instanceof EncryptedObjectStoreData)
{
return (EncryptedObjectStoreData)o;
}
else if (o != null)
{
return new EncryptedObjectStoreData(ASN1Sequence.getInstance(o));
}
return null;
}
public ASN1OctetString getEncryptedContent()
{
return encryptedContent;
}
public AlgorithmIdentifier getEncryptionAlgorithm()
{
return encryptionAlgorithm;
}
public ASN1Primitive toASN1Primitive()
{
ASN1EncodableVector v = new ASN1EncodableVector();
v.add(encryptionAlgorithm);
v.add(encryptedContent);
return new DERSequence(v);
}
}