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

KEKRecipientInfo

public class KEKRecipientInfo extends org.bouncycastle.asn1.ASN1Encodable

Fields Summary
private org.bouncycastle.asn1.DERInteger
version
private KEKIdentifier
kekid
private org.bouncycastle.asn1.x509.AlgorithmIdentifier
keyEncryptionAlgorithm
private org.bouncycastle.asn1.ASN1OctetString
encryptedKey
Constructors Summary
public KEKRecipientInfo(KEKIdentifier kekid, org.bouncycastle.asn1.x509.AlgorithmIdentifier keyEncryptionAlgorithm, org.bouncycastle.asn1.ASN1OctetString encryptedKey)

        this.version = new DERInteger(4);
        this.kekid = kekid;
        this.keyEncryptionAlgorithm = keyEncryptionAlgorithm;
        this.encryptedKey = encryptedKey;
    
public KEKRecipientInfo(org.bouncycastle.asn1.ASN1Sequence seq)

        version = (DERInteger)seq.getObjectAt(0);
        kekid = KEKIdentifier.getInstance(seq.getObjectAt(1));
        keyEncryptionAlgorithm = AlgorithmIdentifier.getInstance(seq.getObjectAt(2));
        encryptedKey = (ASN1OctetString)seq.getObjectAt(3);
    
Methods Summary
public org.bouncycastle.asn1.ASN1OctetStringgetEncryptedKey()

        return encryptedKey;
    
public static org.bouncycastle.asn1.cms.KEKRecipientInfogetInstance(org.bouncycastle.asn1.ASN1TaggedObject obj, boolean explicit)
return a KEKRecipientInfo object from a tagged object.

param
obj the tagged object holding the object we want.
param
explicit true if the object is meant to be explicitly tagged false otherwise.
exception
IllegalArgumentException if the object held by the tagged object cannot be converted.

        return getInstance(ASN1Sequence.getInstance(obj, explicit));
    
public static org.bouncycastle.asn1.cms.KEKRecipientInfogetInstance(java.lang.Object obj)
return a KEKRecipientInfo 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 KEKRecipientInfo)
        {
            return (KEKRecipientInfo)obj;
        }
        
        if(obj instanceof ASN1Sequence)
        {
            return new KEKRecipientInfo((ASN1Sequence)obj);
        }
        
        throw new IllegalArgumentException("Invalid KEKRecipientInfo: " + obj.getClass().getName());
    
public KEKIdentifiergetKekid()

        return kekid;
    
public org.bouncycastle.asn1.x509.AlgorithmIdentifiergetKeyEncryptionAlgorithm()

        return keyEncryptionAlgorithm;
    
public org.bouncycastle.asn1.DERIntegergetVersion()

        return version;
    
public org.bouncycastle.asn1.DERObjecttoASN1Object()
Produce an object suitable for an ASN1OutputStream.
KEKRecipientInfo ::= SEQUENCE {
version CMSVersion, -- always set to 4
kekid KEKIdentifier,
keyEncryptionAlgorithm KeyEncryptionAlgorithmIdentifier,
encryptedKey EncryptedKey
}

        ASN1EncodableVector  v = new ASN1EncodableVector();

        v.add(version);
        v.add(kekid);
        v.add(keyEncryptionAlgorithm);
        v.add(encryptedKey);

        return new DERSequence(v);