|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Object | +--iaik.pkcs.pkcs7.DigestInfo
This class implements the PKCS#7 DigestInfo type.
The PKCS#7
Cryptographic Message Standard specifies the DigestInfo
type as ASN.1 structure whose BER encoded value serves as input for the
digest-encryption process when creating a SignedData object.
DigestInfo ::= SEQUENCE {
digestAlgorithm DigestAlgorithmIdentifier,
digest Digest }
Digest ::= OCTET STRING
The Signed-data content type is used for building digital signatures on
some particular content for one or more signers. For each signer, a message
digest is computed on the content (and any additional authenticated
information) with a signer-specific message-digest algorithm. Resulting
message digest and appertaining digest algorithm identifier are collected
to form a DigestInfo object, which subsequently is DER encoded
for being encrypted with the particular signerīs private key to finally
produce the signer-specific digital signature. Signature value and some
signer-related information are included into a SignerInfo
structure. In that way, for every single signer a specific SignerInfo
object is created. All SignerInfos are are collected
together with the content for forming a SignedData structure.
The constructors and methods of this class are used by the SignerInfo
class for building a DigestInfo to be fed to the digest
encryption process, respectively - on the receiverīs side - for creating a
DigestInfo on the "re-decrypted" DigestInfo ASN.1
structure when parsing for the inherent digest value.
This class only can be used for creating a DigestInfo for an
already computed message digest. This class does not support any mechanisms for
computing a message digest.
Example:
//the message to be hashed:
byte[] message = "Test data to be digested".getBytes();
//compute the message digest:
MessageDigest md = MessageDigest.getInstance("SHA");
md.update(message);
byte[] digest = md.digest();
//create a DigestInfo object and supply the message digest just computed:
DigestInfo digested_info = new DigestInfo(AlgorithmID.sha, digest);
ContentInfo,
SignerInfo,
SignedData| Constructor Summary | |
DigestInfo(AlgorithmID digestAlgorithm,
byte[] digest)
Creates a new DigestInfo from a digest algorithm and a digest. |
|
DigestInfo(ASN1Object obj)
Creates a new DigestInfo from an ASN1Object.
|
|
| Method Summary | |
void |
decode(ASN1Object obj)
Decodes the given ASN.1 DigestInfo object for parsing
the internal structure.
|
byte[] |
getDigest()
Returns the digest value held by this DigestInfo. |
AlgorithmID |
getDigestAlgorithm()
Returns the AlgorithmID of the message-digest algorithm (including any associated parameters) that has been used for calculating the digest on the content and any authenticated information. |
ASN1Object |
toASN1Object()
Returns this DigestInfo as ASN1Object.
|
byte[] |
toByteArray()
Returns this DigestInfo as DER encoded byte array.
|
String |
toString()
Returns a string giving some information about this DigestInfo object. |
String |
toString(boolean detailed)
Returns a string giving some - if requested - detailed information about this DigestInfo object. |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Constructor Detail |
public DigestInfo(AlgorithmID digestAlgorithm,
byte[] digest)
DigestInfo from a digest algorithm and a digest.digestAlgorithm - the identifier of the signer-specific digest
algorithm (including any associated parameters)digest - the digest value computed on the content and any
authenticated data using the the signer-specific
digest algorithmSignerInfo
public DigestInfo(ASN1Object obj)
throws CodingException
DigestInfo from an ASN1Object.
The ASN1Object supplied to this constructor represents an
already exisiting DigestInfo object that may
have been created by calling toASN1Object.
obj - obj the PKCS#7 DigestInfo as ASN1ObjectCodingException - if the object can not be parsedSignerInfo.getDigest(java.security.PublicKey)| Method Detail |
public void decode(ASN1Object obj)
throws CodingException
DigestInfo object for parsing
the internal structure.
This method internally is called when creating a PKCS#7 DigestInfo
object from an already existing DigestInfo object,
supplied as ASN1Object.
decode in interface ASN1Typeobj - the PKCS#7 DigestInfo as ASN1ObjectCodingException - if the object can not be parsedpublic ASN1Object toASN1Object()
DigestInfo as ASN1Object.
The ASN1Object returned by this method may be used as parameter value when
creating a DigestInfo object using the
DigestInfo(ASN1Object obj)
constructor.
toASN1Object in interface ASN1TypeDigestInfo as ASN1Object.public byte[] toByteArray()
DigestInfo as DER encoded byte array.
This method may be used for DER encoding this DigestInfo
object before passing it to the digest encryption process.
public AlgorithmID getDigestAlgorithm()
public byte[] getDigest()
DigestInfo.public String toString()
DigestInfo object.toString in class Objectpublic String toString(boolean detailed)
DigestInfo object.detailed - - whether or not to give detailed information
|
This Javadoc may contain text parts from Internet Standard specifications (RFC 2459, 3280, 3039, 2560, 1521, 821, 822, 2253, 1319, 1321, ,2630, 2631, 2268, 3058, 2984, 2104, 2144, 2040, 2311, 2279, see copyright note) and RSA Data Security Public-Key Cryptography Standards (PKCS#1,3,5,7,8,9,10,12, see copyright note). | ||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
IAIK-JCE 3.1 with IAIK-JCE CC Core 3.1, (c) 1997-2004 IAIK