public class MsgSigDigest extends ESSAttributeValue
The Enhanced Security Services
for S/MIMEv3 (ESS) (RFC 2634) specifies the MsgSigDigest
attribute to be included as an signed attribute in a SignerInfo created by an recipient when answering to a ReceiptRequest by sending a signed receipt
back to the originator:
msgSigDigest ::= OCTET STRING
id-aa-msgSigDigest OBJECT IDENTIFIER ::= { iso(1) member-body(2)
us(840) rsadsi(113549) pkcs(1) pkcs-9(9) smime(16) id-aa(2) 5}
When verifying the signature of a SignerInfo containing signed attributes
a hash has to be calculated over the DER encoding of the signed attributes
to be verified against the signature value. When the originator has requested
a signed receipt the hash value calculated above forms the value of a
MsgSigDigest attribute to be sent back to the originator as signed attribute.
The originator when verifying a Signed Receipt compares the message signature
digest value (kept from the original message or calculated again) with the
value of the msgSigDigest signedAttribute included in the signedData/Receipt
signerInfo. If these digest values are identical, then that proves that the
message signature digest value calculated by the recipient based on the
received original signedData object is the same as that calculated by the
sender. This proves that the recipient received exactly the same original
signedData content and signedAttributes as sent by the sender because that
is the only way that the recipient could have calculated the same message
signature digest value as calculated by the sender. If the digest values
are different, then the signedData/Receipt signature verification process
fails.
This class provides two constructors for creating a new MsgSigDigest.
The first one allows to immediately set
the digest value:
byte[] digest = ...; MsgSigDigest msgSigDigest = new MsgSigDigest(digest);The second
constructor may be used to
create MsgSigDigest attribute immediately from a SignerInfo object:
SignerInfo signerInfo = ...; MsgSigDigest msgSigDigest = new MsgSigDigest(signerInfo);
ReceiptRequest,
Receipt,
SignerInfo| Modifier and Type | Field and Description |
|---|---|
static iaik.asn1.ObjectID |
oid
The attributeType object identifier of this
MsgSigDigest attribute. |
| Constructor and Description |
|---|
MsgSigDigest()
Empty default constructor.
|
MsgSigDigest(iaik.asn1.ASN1Object obj)
Creates an MsgSigDigest from its ASN.1 representation.
|
MsgSigDigest(byte[] digest)
Creates an MsgSigDigest for the given digest value.
|
MsgSigDigest(SignerInfo signerInfo)
Creates a MsgSigDigest from the given SignerInfo.
|
MsgSigDigest(SignerInfo signerInfo,
SecurityProvider securityProvider)
Creates a MsgSigDigest from the given SignerInfo.
|
| Modifier and Type | Method and Description |
|---|---|
void |
decode(iaik.asn1.ASN1Object obj)
Decodes the given ASN.1
MsgSigDigest object for parsing
the internal structure. |
boolean |
equals(java.lang.Object obj)
Compares this
MsgSigDigest to the specified object. |
iaik.asn1.ObjectID |
getAttributeType()
Returns the OID identifying the MsgSigDigest attribute type.
|
byte[] |
getDigest()
Returns the digest value.
|
int |
hashCode()
Returns a hashcode for this object.
|
iaik.asn1.ASN1Object |
toASN1Object()
Returns this MsgSigDigest as ASN1Object.
|
java.lang.String |
toString()
Returns a string representation of this MsgSigDigest.
|
multipleAllowedpublic static final iaik.asn1.ObjectID oid
MsgSigDigest attribute.
The corresponding OID string is "1.2.840.113549.1.9.16.2.5".public MsgSigDigest()
public MsgSigDigest(byte[] digest)
digest - the digest valuepublic MsgSigDigest(SignerInfo signerInfo) throws ESSException
The value of the MsgSigDigest results from calculating a hash over the DER encoding of the signed attributes included in the given SignerInfo.
signerInfo - SignerInfo the SignerInfo from which to create the MsgSigDigestESSException - if no signed attributes are included in the
SignerInfo, or the hash algorithm to be used is not
supported or an error occurs when ancoding the signed
attributespublic MsgSigDigest(SignerInfo signerInfo, SecurityProvider securityProvider) throws ESSException
The value of the MsgSigDigest results from calculating a hash over the DER encoding of the signed attributes included in the given SignerInfo.
signerInfo - SignerInfo the SignerInfo from which to create the MsgSigDigestsecurityProvider - the SecurityProvider to be used by this object,
if null use the default system-wide
installed SecurityProvider; this constructor may
use the SecurityProvider method getHash() to calculate the hash from the SignerInfo
signed attributesESSException - if no signed attributes are included in the
SignerInfo, or the hash algorithm to be used is not
supported or an error occurs when ancoding the signed
attributespublic MsgSigDigest(iaik.asn1.ASN1Object obj)
obj - the MsgSigDigest as ASN1Objectpublic byte[] getDigest()
public boolean equals(java.lang.Object obj)
MsgSigDigest to the specified object.equals in class ESSAttributeValueobj - the object to compare this MsgSigDigest
against.true, if the given object is equal to this
MsgSigDigest,
false otherwisepublic int hashCode()
hashCode in class ESSAttributeValuepublic void decode(iaik.asn1.ASN1Object obj)
MsgSigDigest object for parsing
the internal structure.obj - the MsgSigDigest as ASN1Objectpublic iaik.asn1.ASN1Object toASN1Object()
public iaik.asn1.ObjectID getAttributeType()
getAttributeType in class iaik.asn1.structures.AttributeValuepublic java.lang.String toString()
toString in class iaik.asn1.structures.AttributeValue