iaik.tc.tss.impl.java.tsp
Class TcHash

java.lang.Object
  extended by iaik.tc.tss.impl.java.tsp.TcAttributes
      extended by iaik.tc.tss.impl.java.tsp.TcWorkingObject
          extended by iaik.tc.tss.impl.java.tsp.TcHash
All Implemented Interfaces:
TcIAttributes, TcIHash, TcIWorkingObject

public class TcHash
extends TcWorkingObject
implements TcIHash


Field Summary
static TcBlobData PKCS1_MD2_IDENTIFIER
          PKCS#1 AlgorithmIdentifier for MD2.
static TcBlobData PKCS1_MD4_IDENTIFIER
          PKCS#1 AlgorithmIdentifier for MD4.
static TcBlobData PKCS1_MD5_IDENTIFIER
          PKCS#1 AlgorithmIdentifier for MD5.
static TcBlobData PKCS1_SHA1_IDENTIFIER
          PKCS#1 AlgorithmIdentifier for SHA1.
 
Method Summary
 TcBlobData getHashValue()
          This method returns the hash value of the hash object.
 void setAttribAlgIdentifier(long subFlag, TcBlobData data)
          This method sets the hash algorithm identifier if the init flags TcTssConstants.TSS_HASH_OTHER was provided upon object creation.
 void setHashValue(TcBlobData hashValue)
          This method sets the hash value of the hash object.
 TcBlobData sign(TcIRsaKey key)
          This method signs the hash data of the object with the provided signing key.
 java.lang.Object[] tickStampBlob(TcIRsaKey key, TcTssValidation validationData)
          Time stamps a hash blog
 void updateHashValue(TcBlobData data)
          This method updates the hash object with new data.
 void verifySignature(TcBlobData signature, TcIRsaKey key)
          This method verifies the hash value of the hash object with a given signature.
 
Methods inherited from class iaik.tc.tss.impl.java.tsp.TcAttributes
getAttribData, getAttribUint32, setAttribData, setAttribUint32
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface iaik.tc.tss.api.tspi.TcIAttributes
getAttribData, getAttribUint32, setAttribData, setAttribUint32
 

Field Detail

PKCS1_SHA1_IDENTIFIER

public static final TcBlobData PKCS1_SHA1_IDENTIFIER
PKCS#1 AlgorithmIdentifier for SHA1.

TSS Spec. 1.2 Errata A, page number:
351

PKCS1_MD5_IDENTIFIER

public static final TcBlobData PKCS1_MD5_IDENTIFIER
PKCS#1 AlgorithmIdentifier for MD5.

TSS Spec. 1.2 Errata A, page number:
351

PKCS1_MD4_IDENTIFIER

public static final TcBlobData PKCS1_MD4_IDENTIFIER
PKCS#1 AlgorithmIdentifier for MD4.

TSS Spec. 1.2 Errata A, page number:
351

PKCS1_MD2_IDENTIFIER

public static final TcBlobData PKCS1_MD2_IDENTIFIER
PKCS#1 AlgorithmIdentifier for MD2.

TSS Spec. 1.2 Errata A, page number:
351
Method Detail

getHashValue

public TcBlobData getHashValue()
                        throws TcTssException
Description copied from interface: TcIHash
This method returns the hash value of the hash object.

Specified by:
getHashValue in interface TcIHash
Returns:
Blob containing the hash data.
Throws:
TcTssException

setHashValue

public void setHashValue(TcBlobData hashValue)
                  throws TcTssException
Description copied from interface: TcIHash
This method sets the hash value of the hash object.

Specified by:
setHashValue in interface TcIHash
Parameters:
hashValue - The hash value to be set.
Throws:
TcTssException

sign

public TcBlobData sign(TcIRsaKey key)
                throws TcTssException
Description copied from interface: TcIHash
This method signs the hash data of the object with the provided signing key. The data to be signed must be set previously by calling

Specified by:
sign in interface TcIHash
Parameters:
key - Key object which should be used for the signature.
Returns:
The resulting signature data.
Throws:
TcTssException

updateHashValue

public void updateHashValue(TcBlobData data)
                     throws TcTssException
Description copied from interface: TcIHash
This method updates the hash object with new data. This method can only be called if the hash object was initialized as a with the TcTssConstants.TSS_HASH_SHA1 init flag. Update means that that the provided data is appended to an internal buffer that already holds the data from previous update operations. The SHA1 hash of this internal buffer can be obtained using the TcIHash.getHashValue() method. Calling updateHashValue(a) and updateHashValue(b) is equivalent to updateHashValue(a + b).

Specified by:
updateHashValue in interface TcIHash
Parameters:
data - Blob containing the data to be updated.
Throws:
TcTssException

verifySignature

public void verifySignature(TcBlobData signature,
                            TcIRsaKey key)
                     throws TcTssException
Description copied from interface: TcIHash
This method verifies the hash value of the hash object with a given signature. If no exception is thrown, the signature verification could be done successfully.

Specified by:
verifySignature in interface TcIHash
Parameters:
signature - The signature to be verified.
key - The key which should be used for the signature verification.
Throws:
TcTssException

setAttribAlgIdentifier

public void setAttribAlgIdentifier(long subFlag,
                                   TcBlobData data)
                            throws TcTssException
This method sets the hash algorithm identifier if the init flags TcTssConstants.TSS_HASH_OTHER was provided upon object creation.

Parameters:
subFlag - Ignored.
data - The hash DER encoded AlgorithmIdentifier as defined by the PKCS#1 specification.
Throws:
{@link - TcTssException}
TcTssException

tickStampBlob

public java.lang.Object[] tickStampBlob(TcIRsaKey key,
                                        TcTssValidation validationData)
                                 throws TcTssException
Time stamps a hash blog

Specified by:
tickStampBlob in interface TcIHash
Parameters:
key - Key to sign the time stamp
validationData - holds a nonce incorporated in stamping in the externalData_ field
Returns:
Object array of [0] validationData additionally externalData_ it now holds the signature in the field validationData_ [1] currentTicks at the time of stamping
Throws:
TcTssException