FileDocCategorySizeDatePackage
EncryptedData.javaAPI DocAzureus 3.0.3.42540Tue Dec 19 09:26:54 GMT 2006org.bouncycastle.asn1.pkcs

EncryptedData

public class EncryptedData extends Object implements DEREncodable
The EncryptedData object.
EncryptedData ::= SEQUENCE {
version Version,
encryptedContentInfo EncryptedContentInfo
}


EncryptedContentInfo ::= SEQUENCE {
contentType ContentType,
contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL
}

EncryptedContent ::= OCTET STRING

Fields Summary
ASN1Sequence
data
DERObjectIdentifier
bagId
DERObject
bagValue
Constructors Summary
public EncryptedData(ASN1Sequence seq)

        int version = ((DERInteger)seq.getObjectAt(0)).getValue().intValue();

        if (version != 0)
        {
            throw new IllegalArgumentException("sequence not version 0");
        }

        this.data = (ASN1Sequence)seq.getObjectAt(1);
    
public EncryptedData(DERObjectIdentifier contentType, org.bouncycastle.asn1.x509.AlgorithmIdentifier encryptionAlgorithm, DEREncodable content)

        ASN1EncodableVector v = new ASN1EncodableVector();

        v.add(contentType);
        v.add(encryptionAlgorithm.getDERObject());
        v.add(new BERTaggedObject(false, 0, content));

        data = new BERSequence(v);
    
Methods Summary
public ASN1OctetStringgetContent()

        if (data.size() == 3)
        {
            DERTaggedObject o = (DERTaggedObject)data.getObjectAt(2);

            return ASN1OctetString.getInstance(o.getObject());
        }

        return null;
    
public DERObjectIdentifiergetContentType()

        return (DERObjectIdentifier)data.getObjectAt(0);
    
public DERObjectgetDERObject()

        ASN1EncodableVector  v = new ASN1EncodableVector();

        v.add(new DERInteger(0));
        v.add(data);

        return new BERSequence(v);
    
public org.bouncycastle.asn1.x509.AlgorithmIdentifiergetEncryptionAlgorithm()

        return AlgorithmIdentifier.getInstance(data.getObjectAt(1));
    
public static org.bouncycastle.asn1.pkcs.EncryptedDatagetInstance(java.lang.Object obj)

		 if (obj instanceof EncryptedData)
		 {
			 return (EncryptedData)obj;
		 }
		 else if (obj instanceof ASN1Sequence)
		 {
			 return new EncryptedData((ASN1Sequence)obj);
		 }

		 throw new IllegalArgumentException("unknown object in factory");