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

RecipientInfo

public class RecipientInfo extends org.bouncycastle.asn1.ASN1Encodable

Fields Summary
org.bouncycastle.asn1.DEREncodable
info
Constructors Summary
public RecipientInfo(KeyTransRecipientInfo info)

        this.info = info;
    
public RecipientInfo(KeyAgreeRecipientInfo info)

        this.info = new DERTaggedObject(true, 1, info);
    
public RecipientInfo(KEKRecipientInfo info)

        this.info = new DERTaggedObject(true, 2, info);
    
public RecipientInfo(PasswordRecipientInfo info)

        this.info = new DERTaggedObject(true, 3, info);
    
public RecipientInfo(OtherRecipientInfo info)

        this.info = new DERTaggedObject(true, 4, info);
    
public RecipientInfo(org.bouncycastle.asn1.DERObject info)

        this.info = info;
    
Methods Summary
public org.bouncycastle.asn1.DEREncodablegetInfo()

        if (info instanceof ASN1TaggedObject)
        {
            ASN1TaggedObject o = (ASN1TaggedObject)info;

            switch (o.getTagNo())
            {
            case 1:
                return KeyAgreeRecipientInfo.getInstance(o, true);
            case 2:
                return KEKRecipientInfo.getInstance(o, true);
            case 3:
                return PasswordRecipientInfo.getInstance(o, true);
            case 4:
                return OtherRecipientInfo.getInstance(o, true);
            default:
                throw new IllegalStateException("unknown tag");
            }
        }

        return KeyTransRecipientInfo.getInstance(info);
    
public static org.bouncycastle.asn1.cms.RecipientInfogetInstance(java.lang.Object o)

        if (o == null || o instanceof RecipientInfo)
        {
            return (RecipientInfo)o;
        }
        else if (o instanceof ASN1Sequence)
        {
            return new RecipientInfo((ASN1Sequence)o);
        }
        else if (o instanceof ASN1TaggedObject)
        {
            return new RecipientInfo((ASN1TaggedObject)o);
        }

        throw new IllegalArgumentException("unknown object in factory: "
                                                    + o.getClass().getName());
    
public org.bouncycastle.asn1.DERIntegergetVersion()

        if (info instanceof ASN1TaggedObject)
        {
            ASN1TaggedObject o = (ASN1TaggedObject)info;

            switch (o.getTagNo())
            {
            case 1:
                return KeyAgreeRecipientInfo.getInstance(o, true).getVersion();
            case 2:
                return KEKRecipientInfo.getInstance(o, true).getVersion();
            case 3:
                return PasswordRecipientInfo.getInstance(o, true).getVersion();
            case 4:
                return new DERInteger(0);    // no syntax version for OtherRecipientInfo
            default:
                throw new IllegalStateException("unknown tag");
            }
        }

        return KeyTransRecipientInfo.getInstance(info).getVersion();
    
public booleanisTagged()

        return (info instanceof ASN1TaggedObject);
    
public org.bouncycastle.asn1.DERObjecttoASN1Object()
Produce an object suitable for an ASN1OutputStream.
RecipientInfo ::= CHOICE {
ktri KeyTransRecipientInfo,
kari [1] KeyAgreeRecipientInfo,
kekri [2] KEKRecipientInfo,
pwri [3] PasswordRecipientInfo,
ori [4] OtherRecipientInfo }

        return info.getDERObject();