|
IAIK TSP version 2.32 |
||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object iaik.tsp.MessageImprint
public class 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(AlgorithmID hash_algorithm,
byte[] hashed_message)
To construct a new MessageImprint object, an
AlgorithmID object and the corresponding hash code must be
provided. |
|
MessageImprint(ASN1Object component)
This constructor tries to reconstruct a MessageImprint
object from a given ASN.1 structure. |
Method Summary | |
---|---|
static byte[] |
calculateHash(byte[] toBeHashed,
AlgorithmID hashAlgorithm)
This method calculates the hash value of the given data. |
boolean |
equals(java.lang.Object obj)
Compare two MessageImprint objects. |
byte[] |
getEncoded()
This method DER encodes the ASN.1 MessageImprint object. |
AlgorithmID |
getHashAlgorithm()
This method returns the AlgorithmID object. |
byte[] |
getHashedMessage()
This method returns the hashed message. |
int |
hashCode()
Returns a hash code of this MessageImprint. |
void |
setHashAlgorithm(AlgorithmID hash_algorithm)
Sets the hash algorithm to be used. |
void |
setHashedMessage(byte[] hashed_message)
Sets the hashed message. |
ASN1Object |
toASN1Object()
Returns the ASN.1 structure of the MessageImprint object. |
java.lang.String |
toString()
This method returns a string representation of this object. |
Methods inherited from class java.lang.Object |
---|
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MessageImprint(AlgorithmID hash_algorithm, byte[] hashed_message) throws java.lang.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.
java.lang.NullPointerException
- Thrown if one of the arguments is null
.public MessageImprint(ASN1Object component) throws CodingException
MessageImprint
object from a given ASN.1 structure.
component
- ASN.1 structure to reconstruct.
CodingException
- Thrown if the given ASN1Object
is not a
MessageImprint
ASN.1 object.Method Detail |
---|
public byte[] getEncoded()
MessageImprint
object.
MessageImprint
object.public ASN1Object toASN1Object()
MessageImprint
object.
ASN1Object
of the MessageImprint
object.public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
MessageImprint
objects.
equals
in class java.lang.Object
obj
- Object to compare with.
public void setHashAlgorithm(AlgorithmID hash_algorithm) throws java.lang.NullPointerException
hash_algorithm
- The used hash algorithm.
java.lang.NullPointerException
- If the given parameter is null
.public AlgorithmID getHashAlgorithm()
AlgorithmID
object.
AlgorithmID
object or null
.public void setHashedMessage(byte[] hashed_message)
hashed_message
- The hashed message.public byte[] getHashedMessage()
public java.lang.String toString()
toString
in class java.lang.Object
MessageImprint
object.public static byte[] calculateHash(byte[] toBeHashed, AlgorithmID hashAlgorithm) throws java.security.NoSuchAlgorithmException, java.lang.NullPointerException
toBeHashed
- The data to be hashed.hashAlgorithm
- The used hash algorithm.
java.security.NoSuchAlgorithmException
- Thrown if the given algorithm is not supported.
java.lang.NullPointerException
- Thrown if one of the arguments is null
.
|
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 |