iaik.cms.attributes
Class CMSContentType

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

public class CMSContentType
extends AttributeValue

The CMS ContentType attribute.

The Cryptographic Message Syntax (CMS) (RFC 5652) specifies the ContentType attribute to be included as an signed attribute in a SignerInfo for representing the type of the content included in the corresponding SignedData or as an authenticated attribute in a AuthenticatedData:

 ContentType ::= OBJECT IDENTIFIER

 id-contentType OBJECT IDENTIFIER ::= { iso(1) member-body(2)
        us(840) rsadsi(113549) pkcs(1) pkcs9(9) 3 }
 
As soon as there are any signed attributes are present, the ContentType attribute has to be included to specify the type the content of the corresponding SignedData represents.

When creating a ContentType attribute the content type oid has to be supplied, e.g.:

 CMSContentType contentType = new CMSContentType(ObjectID.cms_data);
 

See Also:
SignerInfo

Field Summary
static ObjectID oid
          The attributeType object identifier of the CMS ContentType attribute.
 
Constructor Summary
CMSContentType()
          Empty default constructor.
CMSContentType(ASN1Object obj)
          Creates an CMS ContentType from its ASN.1 representation.
CMSContentType(ObjectID contentType)
          Creates a CMS ContentType for the given content type OID.
 
Method Summary
 void decode(ASN1Object obj)
          Decodes the given ASN.1 ContentType object for parsing the internal structure.
 boolean equals(java.lang.Object obj)
          Compares this ContentType to the specified object.
 ObjectID get()
          Returns the content type oid.
 ObjectID getAttributeType()
          Returns the OID identifying the ContentType attribute type.
 int hashCode()
          Returns a hashcode for this object.
 boolean multipleAllowed()
          Returns false since only one AttributeValue is allowed in the SET OF AttributeValue of an ContentType attribute.
 ASN1Object toASN1Object()
          Returns this ContentType as ASN1Object.
 java.lang.String toString()
          Returns a string representation of this ContentType.
 
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 the CMS ContentType attribute. The corresponding OID string is "1.2.840.113549.1.9.3".

Constructor Detail

CMSContentType

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


CMSContentType

public CMSContentType(ObjectID contentType)
Creates a CMS ContentType for the given content type OID.

Parameters:
contentType - the content type oid

CMSContentType

public CMSContentType(ASN1Object obj)
Creates an CMS ContentType from its ASN.1 representation.

Parameters:
obj - the CMS ContentType as ASN1Object (object identifier)
Method Detail

get

public ObjectID get()
Returns the content type oid.

Returns:
the content type oid

equals

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

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

hashCode

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

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

decode

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

Parameters:
obj - the ContentType as ASN1Object

toASN1Object

public ASN1Object toASN1Object()
                        throws CodingException
Returns this ContentType as ASN1Object.

Returns:
this ContentType as ASN1Object
Throws:
CodingException - if the ASN1Object cannot be built

getAttributeType

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

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

multipleAllowed

public boolean multipleAllowed()
Returns false since only one AttributeValue is allowed in the SET OF AttributeValue of an ContentType attribute.

Overrides:
multipleAllowed in class AttributeValue
Returns:
false since only one attribute value is allowed

toString

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

Specified by:
toString in class AttributeValue
Returns:
this ContentType 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