|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object iaik.asn1.structures.AttributeValue iaik.cms.attributes.CMSMessageDigest
public class CMSMessageDigest
The CMS MessageDigest attribute.
The Cryptographic Message Syntax (CMS) (RFC 5652)
specifies the MessageDigest
attribute to be included as an signed attribute in a
SignerInfo
or as an authenticated attribute in a AuthenticatedData
for representing the hash value computed on the content data:
MessageDigest ::= OCTET STRING id-messageDigest OBJECT IDENTIFIER ::= { iso(1) member-body(2) us(840) rsadsi(113549) pkcs(1) pkcs9(9) 4 }As soon as there are any signed (or authenticated) attributes are present, the MessageDigest attribute has to be included to "keep" the original hash computed on the content data. Note that when signed attributes are present in fact two hash values are calculated: the first one over the content data (giving the value of the MessageDigest attribute) and the second one over the DER encoding of the signed attributes (giving the final signature value itself).
When creating
a CMSMessageDigest attribute
the hash value has to be supplied:
byte[] digest = ...; CMSMessageDigest messageDigest = new CMSMessageDigest(digest);
SignerInfo
Field Summary | |
---|---|
static ObjectID |
oid
The attributeType object identifier of the CMS MessageDigest attribute. |
Constructor Summary | |
---|---|
CMSMessageDigest()
Empty default constructor. |
|
CMSMessageDigest(ASN1Object obj)
Creates an CMS MessageDigest from its ASN.1 representation. |
|
CMSMessageDigest(byte[] digest)
Creates a CMS MessageDigest for the given digest value. |
Method Summary | |
---|---|
void |
decode(ASN1Object obj)
Decodes the given ASN.1 CMSMessageDigest object for parsing
the internal structure. |
boolean |
equals(java.lang.Object obj)
Compares this CMSMessageDigest to the specified object. |
ObjectID |
getAttributeType()
Returns the OID identifying the CMSMessageDigest attribute type. |
byte[] |
getDigest()
Returns the digest value. |
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 MessageDigest attribute. |
ASN1Object |
toASN1Object()
Returns this CMSMessageDigest as ASN1Object. |
java.lang.String |
toString()
Returns a string representation of this CMSMessageDigest. |
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 |
---|
public static final ObjectID oid
Constructor Detail |
---|
public CMSMessageDigest()
public CMSMessageDigest(byte[] digest)
digest
- the digest valuepublic CMSMessageDigest(ASN1Object obj)
obj
- the CMS MessageDigest as ASN1ObjectMethod Detail |
---|
public byte[] getDigest()
public boolean equals(java.lang.Object obj)
CMSMessageDigest
to the specified object.
equals
in class java.lang.Object
obj
- the object to compare this CMSMessageDigest
against.
true
, if the given object is equal to this
CMSMessageDigest
,
false
otherwisepublic int hashCode()
hashCode
in class java.lang.Object
public void decode(ASN1Object obj)
CMSMessageDigest
object for parsing
the internal structure.
obj
- the CMSMessageDigest as ASN1Objectpublic ASN1Object toASN1Object()
public ObjectID getAttributeType()
getAttributeType
in class AttributeValue
public boolean multipleAllowed()
false
since only one AttributeValue is
allowed in the SET OF AttributeValue of an MessageDigest attribute.
multipleAllowed
in class AttributeValue
false
since only one attribute value is allowedpublic java.lang.String toString()
toString
in class AttributeValue
|
This Javadoc may contain text parts from text parts from IETF Internet Standard specifications (see copyright note). | ||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |