FileDocCategorySizeDatePackage
EncryptedContentInfo.javaAPI DocAndroid 1.5 API3271Wed May 06 22:41:06 BST 2009org.bouncycastle.asn1.cms

EncryptedContentInfo

public class EncryptedContentInfo extends org.bouncycastle.asn1.ASN1Encodable

Fields Summary
private org.bouncycastle.asn1.DERObjectIdentifier
contentType
private org.bouncycastle.asn1.x509.AlgorithmIdentifier
contentEncryptionAlgorithm
private org.bouncycastle.asn1.ASN1OctetString
encryptedContent
Constructors Summary
public EncryptedContentInfo(org.bouncycastle.asn1.DERObjectIdentifier contentType, org.bouncycastle.asn1.x509.AlgorithmIdentifier contentEncryptionAlgorithm, org.bouncycastle.asn1.ASN1OctetString encryptedContent)

        this.contentType = contentType;
        this.contentEncryptionAlgorithm = contentEncryptionAlgorithm;
        this.encryptedContent = encryptedContent;
    
public EncryptedContentInfo(org.bouncycastle.asn1.ASN1Sequence seq)

        contentType = (DERObjectIdentifier)seq.getObjectAt(0);
        contentEncryptionAlgorithm = AlgorithmIdentifier.getInstance(
                                                        seq.getObjectAt(1));
        if (seq.size() > 2)
        {
            encryptedContent = ASN1OctetString.getInstance(
                                (ASN1TaggedObject)seq.getObjectAt(2), false);
        }
    
Methods Summary
public org.bouncycastle.asn1.x509.AlgorithmIdentifiergetContentEncryptionAlgorithm()

        return contentEncryptionAlgorithm;
    
public org.bouncycastle.asn1.DERObjectIdentifiergetContentType()

        return contentType;
    
public org.bouncycastle.asn1.ASN1OctetStringgetEncryptedContent()

        return encryptedContent;
    
public static org.bouncycastle.asn1.cms.EncryptedContentInfogetInstance(java.lang.Object obj)
return an EncryptedContentInfo object from the given object.

param
obj the object we want converted.
exception
IllegalArgumentException if the object cannot be converted.

        if (obj == null || obj instanceof EncryptedContentInfo)
        {
            return (EncryptedContentInfo)obj;
        }
        
        if (obj instanceof ASN1Sequence)
        {
            return new EncryptedContentInfo((ASN1Sequence)obj);
        }
        
        throw new IllegalArgumentException("Invalid EncryptedContentInfo: "
                                                + obj.getClass().getName());
    
public org.bouncycastle.asn1.DERObjecttoASN1Object()
Produce an object suitable for an ASN1OutputStream.
EncryptedContentInfo ::= SEQUENCE {
contentType ContentType,
contentEncryptionAlgorithm ContentEncryptionAlgorithmIdentifier,
encryptedContent [0] IMPLICIT EncryptedContent OPTIONAL
}

        ASN1EncodableVector  v = new ASN1EncodableVector();
        
        v.add(contentType);
        v.add(contentEncryptionAlgorithm);

        if (encryptedContent != null)
        {
            v.add(new BERTaggedObject(false, 0, encryptedContent));
        }
        
        return new BERSequence(v);