IAIK CMS/SMIME Toolkit API Documentation
Version 6.1

iaik.smime.attributes
Class SMIMEEncryptionKeyPreference

java.lang.Object
  extended by iaik.asn1.structures.AttributeValue
      extended by iaik.smime.attributes.SMIMEEncryptionKeyPreference
All Implemented Interfaces:
iaik.asn1.ASN1Type

public class SMIMEEncryptionKeyPreference
extends iaik.asn1.structures.AttributeValue

The S/MIMEv3 SMIMEEncryptionKeyPreference attribute.

S/MIMEv3 (RFC 5751) specifies the SMIMEEncryptionKeyPreference attribute to may be included as signed attribute in a SignerInfo to identify encryption certificate of the sender by by IssuerAndSerialNumber, or SubjectKeyIdentifier, or RecipientKeyIdentifier

 SMIMEEncryptionKeyPreference ::= CHOICE {
   issuerAndSerialNumber   [0] IssuerAndSerialNumber,
   receipentKeyId          [1] RecipientKeyIdentifier,
   subjectAltKeyIdentifier [2] SubjectKeyIdentifier
 }
 
 id-aa OBJECT IDENTIFIER ::= {iso(1) member-body(2) usa(840)
    rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) attributes(2)}

 id-aa-encrypKeyPref OBJECT IDENTIFIER ::= {id-aa 11}
 

When creating a SMIMEEncryptionKeyPreference object specify the identifier for the encryption certificate of the sender, e.g.:

 X509Certificate encyrptionCert = ...;
 IssuerAndSerialNumber ias = new IssuerAndSerialNumber(encryptionCert);
 SMIMEEncryptionKeyPreference sMIMEEncryptionKeyPreference = 
   new SMIMEEncryptionKeyPreference(ias);
 

See Also:
IssuerAndSerialNumber, SubjectKeyID, RecipientKeyIdentifier, CertificateIdentifier

Field Summary
static iaik.asn1.ObjectID oid
          The attributeType object identifier of this SMIMEEncryptionKeyPreference attribute.
 
Constructor Summary
SMIMEEncryptionKeyPreference()
          Empty default constructor.
SMIMEEncryptionKeyPreference(iaik.asn1.ASN1Object obj)
          Creates an SMIMEEncryptionKeyPreference from its ASN.1 representation.
SMIMEEncryptionKeyPreference(CertificateIdentifier encryptionCertID)
          Creates an SMIMEEncryptionKeyPreference for the given encryption cert identifier.
 
Method Summary
 void decode(iaik.asn1.ASN1Object obj)
          Decodes the given ASN.1 SMIMEEncryptionKeyPreference object for parsing the internal structure.
 boolean equals(java.lang.Object obj)
          Compares this SMIMEEncryptionKeyPreference to the specified object.
 iaik.asn1.ObjectID getAttributeType()
          Returns the OID identifying the SMIMEEncryptionKeyPreference attribute type.
 CertificateIdentifier getEncryptionCertID()
          Returns the the encryption cert id.
 int hashCode()
          Returns a hashcode for this MSOEEncryptionKeyPreference.
 iaik.asn1.ASN1Object toASN1Object()
          Returns this SMIMEEncryptionKeyPreference as ASN1Object.
 java.lang.String toString()
          Returns a string representation of this SMIMEEncryptionKeyPreference.
 
Methods inherited from class iaik.asn1.structures.AttributeValue
getName, multipleAllowed
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

oid

public static final iaik.asn1.ObjectID oid
The attributeType object identifier of this SMIMEEncryptionKeyPreference attribute. The corresponding OID string is "1.2.840.113549.1.9.16.2.11".

Constructor Detail

SMIMEEncryptionKeyPreference

public SMIMEEncryptionKeyPreference()
Empty default constructor. Required for dynamic object creation. Shall NOT be used by an application.


SMIMEEncryptionKeyPreference

public SMIMEEncryptionKeyPreference(CertificateIdentifier encryptionCertID)
Creates an SMIMEEncryptionKeyPreference for the given encryption cert identifier.

Parameters:
encryptionCertID - the certificate identifier identifying the encryption cert of the sender, either by IssuerAndSerialNumber, SubjectKeyIdentifier, or RecipientKeyIdentifier

SMIMEEncryptionKeyPreference

public SMIMEEncryptionKeyPreference(iaik.asn1.ASN1Object obj)
                             throws iaik.asn1.CodingException
Creates an SMIMEEncryptionKeyPreference from its ASN.1 representation.

Parameters:
obj - the SMIMEEncryptionKeyPreference as ASN1Object
Throws:
iaik.asn1.CodingException - if the encoding is invalid
Method Detail

getEncryptionCertID

public CertificateIdentifier getEncryptionCertID()
Returns the the encryption cert id.

Returns:
the certificate identifier identifying the encryption cert of the sender, either by IssuerAndSerialNumber, SubjectKeyIdentifier, or RecipientKeyIdentifier

decode

public void decode(iaik.asn1.ASN1Object obj)
            throws iaik.asn1.CodingException
Decodes the given ASN.1 SMIMEEncryptionKeyPreference object for parsing the internal structure.

Parameters:
obj - the SMIMEEncryptionKeyPreference as ASN1Object
Throws:
iaik.asn1.CodingException - if the encoding is invalid

equals

public boolean equals(java.lang.Object obj)
Compares this SMIMEEncryptionKeyPreference to the specified object.

Overrides:
equals in class java.lang.Object
Parameters:
obj - the object to compare this SMIMEEncryptionKeyPreference against.
Returns:
true, if the given object is equal to this SMIMEEncryptionKeyPreference, false otherwise

hashCode

public int hashCode()
Returns a hashcode for this MSOEEncryptionKeyPreference.

Overrides:
hashCode in class java.lang.Object
Returns:
a hashcode for this MSOEEncryptionKeyPreference

toASN1Object

public iaik.asn1.ASN1Object toASN1Object()
                                  throws iaik.asn1.CodingException
Returns this SMIMEEncryptionKeyPreference as ASN1Object.

Returns:
this SMIMEEncryptionKeyPreference as ASN1Object
Throws:
iaik.asn1.CodingException - if the ASN.1 object cannot be built

getAttributeType

public iaik.asn1.ObjectID getAttributeType()
Returns the OID identifying the SMIMEEncryptionKeyPreference attribute type.

Specified by:
getAttributeType in class iaik.asn1.structures.AttributeValue
Returns:
the OID identifying the SMIMEEncryptionKeyPreference attribute type.

toString

public java.lang.String toString()
Returns a string representation of this SMIMEEncryptionKeyPreference.

Specified by:
toString in class iaik.asn1.structures.AttributeValue
Returns:
this SMIMEEncryptionKeyPreference as string

IAIK CMS/SMIME Toolkit API Documentation
Version 6.1

v6.1
(c) 2002 IAIK, (c) 2003 - 2025 SIC