01: package org.bouncycastle.asn1.smime;
02:
03: import org.bouncycastle.asn1.ASN1OctetString;
04: import org.bouncycastle.asn1.DERSet;
05: import org.bouncycastle.asn1.DERTaggedObject;
06: import org.bouncycastle.asn1.cms.Attribute;
07: import org.bouncycastle.asn1.cms.IssuerAndSerialNumber;
08: import org.bouncycastle.asn1.cms.RecipientKeyIdentifier;
09:
10: /**
11: * The SMIMEEncryptionKeyPreference object.
12: * <pre>
13: * SMIMEEncryptionKeyPreference ::= CHOICE {
14: * issuerAndSerialNumber [0] IssuerAndSerialNumber,
15: * receipentKeyId [1] RecipientKeyIdentifier,
16: * subjectAltKeyIdentifier [2] SubjectKeyIdentifier
17: * }
18: * </pre>
19: */
20: public class SMIMEEncryptionKeyPreferenceAttribute extends Attribute {
21: public SMIMEEncryptionKeyPreferenceAttribute(
22: IssuerAndSerialNumber issAndSer) {
23: super (SMIMEAttributes.encrypKeyPref, new DERSet(
24: new DERTaggedObject(false, 0, issAndSer)));
25: }
26:
27: public SMIMEEncryptionKeyPreferenceAttribute(
28: RecipientKeyIdentifier rKeyId) {
29:
30: super (SMIMEAttributes.encrypKeyPref, new DERSet(
31: new DERTaggedObject(false, 1, rKeyId)));
32: }
33:
34: /**
35: * @param sKeyId the subjectKeyIdentifier value (normally the X.509 one)
36: */
37: public SMIMEEncryptionKeyPreferenceAttribute(ASN1OctetString sKeyId) {
38:
39: super (SMIMEAttributes.encrypKeyPref, new DERSet(
40: new DERTaggedObject(false, 2, sKeyId)));
41: }
42: }
|