Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## javacard.security
Class InitializedMessageDigest

    java.lang.Object
      javacard.security.MessageDigest
          javacard.security.InitializedMessageDigest

    @TransactionType(value=SUPPORTS)
    public abstract class InitializedMessageDigest

extends MessageDigest

The `InitializedMessageDigest` class is a subclass of the base class `MessageDigest`. This class is used to generate a hash representing a specified message but with the additional capability to initialize the starting hash value corresponding to a previously hashed part of the message. Implementations of `InitializedMessageDigest` algorithms must extend this class and implement all the abstract methods.

A tear or card reset event resets a `InitializedMessageDigest` object to the initial state (state upon construction).

Even if a transaction is in progress, update of intermediate result state in the implementation instance shall not participate in the transaction.

Since:
  2.2.2

Field Summary

Fields inherited from class javacard.security.MessageDigest
`ALG_MD5, ALG_RIPEMD160, ALG_SHA, ALG_SHA_224, ALG_SHA_256, ALG_SHA_384, ALG_SHA_512, LENGTH_MD5, LENGTH_RIPEMD160, LENGTH_SHA, LENGTH_SHA_256, LENGTH_SHA_384, LENGTH_SHA_512, SERVICE_NAME`

Constructor Summary
`protected` | `InitializedMessageDigest()` protected constructor

Method Summary
`abstract void` | `setInitialDigest(byte[] initialDigestBuf, short initialDigestOffset, short initialDigestLength, byte[] digestedMsgLenBuf, short digestedMsgLenOffset, short digestedMsgLenLength)` This method initializes the starting hash value in place of the default value used by the `MessageDigest` superclass.

Methods inherited from class javacard.security.MessageDigest
`doFinal, getAlgorithm, getAlgorithmName, getInitializedMessageDigestInstance, getInitializedMessageDigestInstance, getInitializedMessageDigestInstance, getInstance, getInstance, getInstance, getLength, reset, update`

Methods inherited from class java.lang.Object
`equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### InitializedMessageDigest

    protected InitializedMessageDigest()

  protected constructor

Method Detail

### setInitialDigest

    public abstract void setInitialDigest(byte[] initialDigestBuf,
                                          short initialDigestOffset,
                                          short initialDigestLength,
                                          byte[] digestedMsgLenBuf,
                                          short digestedMsgLenOffset,
                                          short digestedMsgLenLength)
                                   throws CryptoException

  This method initializes the starting hash value in place of the default value used by the `MessageDigest` superclass. The starting hash value represents the previously computed hash (using the same algorithm) of the first part of the message. The remaining bytes of the message must be presented to this `InitializedMessageDigest` object via the `update` and `doFinal` methods to generate the final message digest.

  Note:

  - The maximum allowed value of the byte length of the first part of the message is algorithm specific

  Parameters:
    `initialDigestBuf` - input buffer containing the starting hash value representing the previously computed hash (using the same algorithm) of first part of the message
    `initialDigestOffset` - offset into `initialDigestBuf` array where the starting digest value data begins
    `initialDigestLength` - the length of data in `initialDigestBuf` array.
    `digestedMsgLenBuf` - the byte array containing the number of bytes in the first part of the message that has previously been hashed to obtain the specified starting digest value
    `digestedMsgLenOffset` - the offset within `digestedMsgLenBuf` where the digested length begins(the bytes starting at this offset for `digestedMsgLenLength` bytes are concatenated to form the actual digested message length value)
    `digestedMsgLenLength` - byte length of the digested length
  Throws:
    `CryptoException` - with the following reason codes:
    - `CryptoException.ILLEGAL_VALUE` if the parameter `initialDigestLength` is not equal to the intermediate hash value size of the algorithm or if the number of bytes in the first part of the message that has previously been hashed is 0 or not a multiple of the algorithm's block size or greater than the maximum length supported by the algorithm (see `ALG_*` algorithm descriptions `ALG_SHA`).

Overview | Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

Copyright (c) 2009 Sun Microsystems, Inc. All rights reserved.