iaik.smime.ess
Class ContentIdentifier

java.lang.Object
  extended by iaik.asn1.structures.AttributeValue
      extended by iaik.smime.ess.ESSAttributeValue
          extended by iaik.smime.ess.ContentIdentifier
All Implemented Interfaces:
ASN1Type

public class ContentIdentifier
extends ESSAttributeValue

The S/MIMEv3 ESS ContentIdentifier attribute.

The Enhanced Security Services for S/MIMEv3 (ESS) (RFC 2634) specifies the ContentIdentifier attribute to may be included as an attribute in a SignerInfo to carry a unique identifier assigned to the message.

 ContentIdentifier ::= OCTET STRING

 id-aa-contentIdentifier OBJECT IDENTIFIER ::= { iso(1) member-body(2)
    us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) id-aa(2) 7}
 
When requesting a signed receipt from a recipient the originator includes a signed content identifier for the message in its ReceiptRequest attribute to associate the signed receipt with the message requesting the signed receipt. The receipient copies the signed content identifier of the received ReceiptRequest atribute into its signed receipt attribute to be sent back to the originator.
To ensure global uniqueness, the minimal signedContentIdentifier SHOULD contain a concatenation of user-specific identification information (such as a user name or public keying material identification information), a GeneralizedTime string, and a random number.

This class provides three constructors for creating a new ContentIdentifier. The first one allows to immediately set the content identifier bytes:

 byte[] identifier = ...;
 ContentIdentifier contentIdentifier = new ContentIdentifier(identifier);
 
The other two constructors may be used to create minimal signed content identifiers as described above from public keying material or user name and GeneralizedTime string and public number, e.g.:
 // the public key of the user
 PublicKey publicKey = ...;
 // the date from which to create the GeneralizedTime
 Date date = ...;
 // a random number
 byte[] rand = ...;
 ContentIdentifier contentIdentifier = new ContentIdentifier(publicKey, date, rand);
 


Field Summary
static ObjectID oid
          The attributeType object identifier of this ContentIdentifier attribute.
 
Constructor Summary
ContentIdentifier()
          Empty default constructor.
ContentIdentifier(ASN1Object obj)
          Creates an ContentIdentifier from its ASN.1 representation.
ContentIdentifier(byte[] identifier)
          Creates an ContentIdentifier for the given identifier bytes.
ContentIdentifier(GeneralNames name)
          Creates a ContentIdentifier from user name, date and random number.
ContentIdentifier(GeneralNames name, java.util.Date date, byte[] rand)
          Creates a ContentIdentifier from user name, date and random number.
ContentIdentifier(GeneralNames name, SecurityProvider securityProvider)
          Creates a ContentIdentifier from user name, date and random number.
ContentIdentifier(Name name)
          Creates a ContentIdentifier from user distinguished name, date and random number.
ContentIdentifier(Name name, java.util.Date date, byte[] rand)
          Creates a ContentIdentifier from user ditinguished name, date and random number.
ContentIdentifier(Name name, SecurityProvider securityProvider)
          Creates a ContentIdentifier from user distinguished name, date and random number.
ContentIdentifier(java.security.PublicKey publicKey)
          Creates a ContentIdentifier from the given public keying material.
ContentIdentifier(java.security.PublicKey publicKey, java.util.Date date, byte[] rand)
          Creates a ContentIdentifier from public keying material, date and random number.
ContentIdentifier(java.security.PublicKey publicKey, SecurityProvider securityProvider)
          Creates a ContentIdentifier from the given public keying material.
 
Method Summary
 void decode(ASN1Object obj)
          Decodes the given ASN.1 ContentIdentifier object for parsing the internal structure.
 boolean equals(java.lang.Object obj)
          Compares this ContentIdentifier to the specified object.
 byte[] get()
          Returns the identifier bytes.
 ObjectID getAttributeType()
          Returns the OID identifying the ContentIdentifier attribute type.
 int hashCode()
          Returns a hashcode for this ContentIdentifier.
 ASN1Object toASN1Object()
          Returns this ContentIdentifier as ASN1Object.
 java.lang.String toString()
          Returns a string representation of this ContentIdentifier.
 
Methods inherited from class iaik.smime.ess.ESSAttributeValue
multipleAllowed
 
Methods inherited from class iaik.asn1.structures.AttributeValue
getName
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

oid

public static final ObjectID oid
The attributeType object identifier of this ContentIdentifier attribute. The corresponding OID string is "1.2.840.113549.1.9.16.2.7".

Constructor Detail

ContentIdentifier

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


ContentIdentifier

public ContentIdentifier(byte[] identifier)
Creates an ContentIdentifier for the given identifier bytes.

Parameters:
identifier - the bytes identifying the content

ContentIdentifier

public ContentIdentifier(java.security.PublicKey publicKey)
Creates a ContentIdentifier from the given public keying material.

The ContentIdentifier is an attribute (OCTET STRING) used to carry a unique identifier assigned to the message. To ensure global uniqueness, the minimal signedContentIdentifier SHOULD contain a concatenation of user-specific identification information (such as a user name or public keying material identification information), a GeneralizedTime string, and a random number. This constructor may be used for creating a minimal signedContentIdentifier from the given user keying material; GeneralizedTime is set to the current date and random number is calculated as 16 byte random. Use this constructor if you yourself want to set date and random number.

Parameters:
publicKey - the public key of the user

ContentIdentifier

public ContentIdentifier(java.security.PublicKey publicKey,
                         SecurityProvider securityProvider)
Creates a ContentIdentifier from the given public keying material.

The ContentIdentifier is an attribute (OCTET STRING) used to carry a unique identifier assigned to the message. To ensure global uniqueness, the minimal signedContentIdentifier SHOULD contain a concatenation of user-specific identification information (such as a user name or public keying material identification information), a GeneralizedTime string, and a random number. This constructor may be used for creating a minimal signedContentIdentifier from the given user keying material; GeneralizedTime is set to the current date and random number is calculated as 16 byte random. Use this constructor if you yourself want to set date and random number.

Parameters:
publicKey - the public key of the user
securityProvider - the SecurityProvider to be used by this object (only required if no rand is supplied), if null use the default system-wide installed SecurityProvider; this constructor may use the SecurityProvider method getSecureRandom() to calculate the random number used for building the identifier

ContentIdentifier

public ContentIdentifier(java.security.PublicKey publicKey,
                         java.util.Date date,
                         byte[] rand)
Creates a ContentIdentifier from public keying material, date and random number.

The ContentIdentifier is an attribute (OCTET STRING) used to carry a unique identifier assigned to the message. To ensure global uniqueness, the minimal signedContentIdentifier SHOULD contain a concatenation of user-specific identification information (such as a user name or public keying material identification information), a GeneralizedTime string, and a random number. This constructor may be used for creating a minimal signedContentIdentifier from user keying material, GeneralizedTime date and random number.

Parameters:
publicKey - the public key of the user
date - the date to be encoded as GeneralizedTime
rand - a random number

ContentIdentifier

public ContentIdentifier(GeneralNames name)
                  throws CodingException
Creates a ContentIdentifier from user name, date and random number.

The ContentIdentifier is an attribute (OCTET STRING) used to carry a unique identifier assigned to the message. To ensure global uniqueness, the minimal signedContentIdentifier SHOULD contain a concatenation of user-specific identification information (such as a user name or public keying material identification information), a GeneralizedTime string, and a random number. This constructor may be used for creating a minimal signedContentIdentifier from the given user name; GeneralizedTime is set to the current date and random number is calculated as 16 byte random. Use this constructor if you yourself want to set date and random number.

Parameters:
name - the name of the user
Throws:
CodingException - if there occurs an error when encoding the GeneralName

ContentIdentifier

public ContentIdentifier(GeneralNames name,
                         SecurityProvider securityProvider)
                  throws CodingException
Creates a ContentIdentifier from user name, date and random number.

The ContentIdentifier is an attribute (OCTET STRING) used to carry a unique identifier assigned to the message. To ensure global uniqueness, the minimal signedContentIdentifier SHOULD contain a concatenation of user-specific identification information (such as a user name or public keying material identification information), a GeneralizedTime string, and a random number. This constructor may be used for creating a minimal signedContentIdentifier from the given user name; GeneralizedTime is set to the current date and random number is calculated as 16 byte random. Use this constructor if you yourself want to set date and random number.

Parameters:
name - the name of the user
securityProvider - the SecurityProvider to be used by this object (only required if no rand is supplied), if null use the default system-wide installed SecurityProvider; this constructor may use the SecurityProvider method getSecureRandom() to calculate the random number used for building the identifier
Throws:
CodingException - if there occurs an error when encoding the GeneralName

ContentIdentifier

public ContentIdentifier(GeneralNames name,
                         java.util.Date date,
                         byte[] rand)
                  throws CodingException
Creates a ContentIdentifier from user name, date and random number.

The ContentIdentifier is an attribute (OCTET STRING) used to carry a unique identifier assigned to the message. To ensure global uniqueness, the minimal signedContentIdentifier SHOULD contain a concatenation of user-specific identification information (such as a user name or public keying material identification information), a GeneralizedTime string, and a random number. This constructor may be used for creating a minimal signedContentIdentifier from user name, GeneralizedTime date and random number.

Parameters:
name - the name of the user
date - the date to be encoded as GeneralizedTime
rand - a random number
Throws:
CodingException - if there occurs an error when encoding the GeneralName

ContentIdentifier

public ContentIdentifier(Name name)
                  throws CodingException
Creates a ContentIdentifier from user distinguished name, date and random number.

The ContentIdentifier is an attribute (OCTET STRING) used to carry a unique identifier assigned to the message. To ensure global uniqueness, the minimal signedContentIdentifier SHOULD contain a concatenation of user-specific identification information (such as a user name or public keying material identification information), a GeneralizedTime string, and a random number. This constructor may be used for creating a minimal signedContentIdentifier from the given user name; GeneralizedTime is set to the current date and random number is calculated as 16 byte random. Use this constructor if you yourself want to set date and random number.

Parameters:
name - the ditinguished name of the user
Throws:
CodingException - if there occurs an error when encoding the Name

ContentIdentifier

public ContentIdentifier(Name name,
                         SecurityProvider securityProvider)
                  throws CodingException
Creates a ContentIdentifier from user distinguished name, date and random number.

The ContentIdentifier is an attribute (OCTET STRING) used to carry a unique identifier assigned to the message. To ensure global uniqueness, the minimal signedContentIdentifier SHOULD contain a concatenation of user-specific identification information (such as a user name or public keying material identification information), a GeneralizedTime string, and a random number. This constructor may be used for creating a minimal signedContentIdentifier from the given user name; GeneralizedTime is set to the current date and random number is calculated as 16 byte random. Use this constructor if you yourself want to set date and random number.

Parameters:
name - the ditinguished name of the user
securityProvider - the SecurityProvider to be used by this object (only required if no rand is supplied), if null use the default system-wide installed SecurityProvider; this constructor may use the SecurityProvider method getSecureRandom() to calculate the random number used for building the identifier
Throws:
CodingException - if there occurs an error when encoding the Name

ContentIdentifier

public ContentIdentifier(Name name,
                         java.util.Date date,
                         byte[] rand)
                  throws CodingException
Creates a ContentIdentifier from user ditinguished name, date and random number.

The ContentIdentifier is an attribute (OCTET STRING) used to carry a unique identifier assigned to the message. To ensure global uniqueness, the minimal signedContentIdentifier SHOULD contain a concatenation of user-specific identification information (such as a user name or public keying material identification information), a GeneralizedTime string, and a random number. This constructor may be used for creating a minimal signedContentIdentifier from user name, GeneralizedTime date and random number.

Parameters:
name - the ditinguished name of the user
date - the date to be encoded as GeneralizedTime
rand - a random number
Throws:
CodingException

ContentIdentifier

public ContentIdentifier(ASN1Object obj)
Creates an ContentIdentifier from its ASN.1 representation.

Parameters:
obj - the ContentIdentifier as ASN1Object
Method Detail

get

public byte[] get()
Returns the identifier bytes.

Returns:
the identifier bytes

equals

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

Specified by:
equals in class ESSAttributeValue
Parameters:
obj - the object to compare this ContentIdentifier against.
Returns:
true, if the given object is equal to this ContentIdentifier, false otherwise

hashCode

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

Overrides:
hashCode in class ESSAttributeValue
Returns:
a hashcode for this ContentIdentifier

decode

public void decode(ASN1Object obj)
Decodes the given ASN.1 ContentIdentifier object for parsing the internal structure.

Parameters:
obj - the ContentIdentifier as ASN1Object

toASN1Object

public ASN1Object toASN1Object()
Returns this ContentIdentifier as ASN1Object.

Returns:
this ContentIdentifier as ASN1Object

getAttributeType

public ObjectID getAttributeType()
Returns the OID identifying the ContentIdentifier attribute type.

Specified by:
getAttributeType in class AttributeValue
Returns:
the OID identifying the ContentIdentifier attribute type.

toString

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

Specified by:
toString in class AttributeValue
Returns:
this ContentIdentifier as string

This Javadoc may contain text parts from text parts from IETF Internet Standard specifications (see copyright note).

IAIK-CMS 6.0, (c) 2002 IAIK, (c) 2003, 2023 SIC