|
IAIK TSP version 2.01 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectiaik.tsp.MessageImprint
This class implements the TSP ASN.1 type MessageImprint
as
it is specified in RFC 3161.
MessageImprint ::= SEQUENCE { hashAlgorithm AlgorithmIdentifier, hashedMessage OCTET STRING }
This class handles the ASN.1 structure and the DER encoding and decoding of this structure.
Constructor Summary | |
MessageImprint(iaik.asn1.structures.AlgorithmID hash_algorithm,
byte[] hashed_message)
To construct a new MessageImprint object, an
AlgorithmID object and the corresponding hash code must be
provided. |
|
MessageImprint(iaik.asn1.ASN1Object component)
This constructor tries to reconstruct a MessageImprint
object from a given ASN.1 structure. |
Method Summary | |
static byte[] |
calculateHash(byte[] toBeHashed,
iaik.asn1.structures.AlgorithmID hashAlgorithm)
This method calculates the hash value of the given data. |
boolean |
equals(Object obj)
Compare two MessageImprint objects. |
byte[] |
getEncoded()
This method DER encodes the ASN.1 MessageImprint object. |
iaik.asn1.structures.AlgorithmID |
getHashAlgorithm()
This method returns the AlgorithmID object. |
byte[] |
getHashedMessage()
This method returns the hashed message. |
void |
setHashAlgorithm(iaik.asn1.structures.AlgorithmID hash_algorithm)
Sets the hash algorithm to be used. |
void |
setHashedMessage(byte[] hashed_message)
Sets the hashed message. |
iaik.asn1.ASN1Object |
toASN1Object()
Returns the ASN.1 structure of the MessageImprint object. |
String |
toString()
This method returns a string representation of this object. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
public MessageImprint(iaik.asn1.structures.AlgorithmID hash_algorithm, byte[] hashed_message) throws NullPointerException
MessageImprint
object, an
AlgorithmID
object and the corresponding hash code must be
provided.
hash_algorithm
- A one-way collision resistant hash algorithm.hashed_message
- The hashed message.
NullPointerException
- Thrown if one of the arguments is null
.public MessageImprint(iaik.asn1.ASN1Object component) throws iaik.asn1.CodingException
MessageImprint
object from a given ASN.1 structure.
component
- ASN.1 structure to reconstruct.
iaik.asn1.CodingException
- Thrown if the given ASN1Object
is not a
MessageImprint
ASN.1 object.Method Detail |
public byte[] getEncoded()
MessageImprint
object.
MessageImprint
object.public iaik.asn1.ASN1Object toASN1Object()
MessageImprint
object.
ASN1Object
of the MessageImprint
object.public boolean equals(Object obj)
MessageImprint
objects.
obj
- Object to compare with.
public void setHashAlgorithm(iaik.asn1.structures.AlgorithmID hash_algorithm) throws NullPointerException
hash_algorithm
- The used hash algorithm.
NullPointerException
- If the given parameter is null
.public iaik.asn1.structures.AlgorithmID getHashAlgorithm()
AlgorithmID
object.
AlgorithmID
object or null
.public void setHashedMessage(byte[] hashed_message)
hashed_message
- The hashed message.public byte[] getHashedMessage()
public String toString()
MessageImprint
object.public static byte[] calculateHash(byte[] toBeHashed, iaik.asn1.structures.AlgorithmID hashAlgorithm) throws NoSuchAlgorithmException, NullPointerException
toBeHashed
- The data to be hashed.hashAlgorithm
- The used hash algorithm.
NoSuchAlgorithmException
- Thrown if the given algorithm is not supported.
NullPointerException
- Thrown if one of the arguments is null
.
|
This Javadoc may contain text parts from IETF Internet Standard specifications (see copyright note) and RSA Data Security Public-Key Cryptography Standards (see copyright note). | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |