com.ibm.crypto.provider
Class HmacMD5

java.lang.Object
  |
  +--javax.crypto.MacSpi
        |
        +--com.ibm.crypto.provider.HmacMD5

public final class HmacMD5
extends MacSpi
implements Cloneable

This is an implementation of the HMAC-MD5 algorithm.


Constructor Summary
HmacMD5()
          Standard constructor, creates a new HmacMD5 instance.
 
Method Summary
 Object clone()
          Returns a clone if the implementation is cloneable.
protected  byte[] engineDoFinal()
          Completes the HMAC computation and resets the HMAC for further use, maintaining the secret key that the HMAC was initialized with.
protected  int engineGetMacLength()
          Returns the length of the HMAC in bytes.
protected  void engineInit(Key key, AlgorithmParameterSpec params)
          Initializes the HMAC with the given secret key and algorithm parameters.
protected  void engineReset()
          Resets the HMAC for further use, maintaining the secret key that the HMAC was initialized with.
protected  void engineUpdate(byte input)
          Processes the given byte.
protected  void engineUpdate(byte[] input, int offset, int len)
          Processes the first len bytes in input, starting at offset.
 
Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

HmacMD5

public HmacMD5()
        throws NoSuchAlgorithmException
Standard constructor, creates a new HmacMD5 instance. Verify the JCE framework in the constructor.
Throws:
SecurityException - if fails to verify the JCE framework.
Method Detail

engineGetMacLength

protected int engineGetMacLength()
Returns the length of the HMAC in bytes.
Overrides:
engineGetMacLength in class MacSpi
Returns:
the HMAC length in bytes.

engineInit

protected void engineInit(Key key,
                          AlgorithmParameterSpec params)
                   throws InvalidKeyException,
                          InvalidAlgorithmParameterException
Initializes the HMAC with the given secret key and algorithm parameters.
Overrides:
engineInit in class MacSpi
Parameters:
key - the secret key.
params - the algorithm parameters.
Throws:
InvalidKeyException - if the given key is inappropriate for initializing this MAC.
InvalidAlgorithmParameterException - if the given algorithm parameters are inappropriate for this MAC.

engineUpdate

protected void engineUpdate(byte input)
Processes the given byte.
Overrides:
engineUpdate in class MacSpi
Parameters:
input - the input byte to be processed.

engineUpdate

protected void engineUpdate(byte[] input,
                            int offset,
                            int len)
Processes the first len bytes in input, starting at offset.
Overrides:
engineUpdate in class MacSpi
Parameters:
input - the input buffer.
offset - the offset in input where the input starts.
len - the number of bytes to process.

engineDoFinal

protected byte[] engineDoFinal()
Completes the HMAC computation and resets the HMAC for further use, maintaining the secret key that the HMAC was initialized with.
Overrides:
engineDoFinal in class MacSpi
Returns:
the HMAC result.

engineReset

protected void engineReset()
Resets the HMAC for further use, maintaining the secret key that the HMAC was initialized with.
Overrides:
engineReset in class MacSpi

clone

public Object clone()
Description copied from class: MacSpi
Returns a clone if the implementation is cloneable.
Overrides:
clone in class MacSpi
Tags copied from class: MacSpi
Returns:
a clone if the implementation is cloneable.
Throws:
CloneNotSupportedException - if this is called on an implementation that does not support Cloneable.