com.ibm.crypto.fips.provider

Class HmacSHA1

  1. java.lang.Object
  2. extended byjavax.crypto.MacSpi
  3. extended bycom.ibm.crypto.fips.provider.HmacSHA1
All implemented interfaces:
AlgorithmStatus, java.lang.Cloneable

  1. public final class HmacSHA1
  2. extends javax.crypto.MacSpi
  3. implements java.lang.Cloneable, AlgorithmStatus
This is an implementation of the HMAC-SHA1 algorithm.
Version:
1.6, 11/09/99
Author:
Jan Luehe

Constructor Summary

Constructor and Description
HmacSHA1()
Standard constructor, creates a new HmacSHA1 instance.

Method Summary

Modifier and Type Method and Description
  1. java.lang.Object
clone()
  1. protected
  2. byte[]
engineDoFinal()
Completes the HMAC computation and resets the HMAC for further use, maintaining the secret key that the HMAC was initialized with.
  1. protected
  2. int
engineGetMacLength()
Returns the length of the HMAC in bytes.
  1. protected
  2. void
engineInit(java.security.Key key,java.security.spec.AlgorithmParameterSpec params)
Initializes the HMAC with the given secret key and algorithm parameters.
  1. protected
  2. void
engineReset()
Resets the HMAC for further use, maintaining the secret key that the HMAC was initialized with.
  1. protected
  2. void
engineUpdate(byte input)
Processes the given byte.
  1. protected
  2. void
engineUpdate(byte[] input,int offset,int len)
Processes the first len bytes in input, starting at offset.
  1. protected
  2. void
finalize()
This function zeroizes the key so that it isn't in memory when GC is done.
  1. java.lang.Object
internalClone()
  1. protected
  2. byte[]
internalDoFinal()
Completes the HMAC computation and resets the HMAC for further use, maintaining the secret key that the HMAC was initialized with.
  1. protected
  2. int
internalGetMacLength()
Returns the length of the HMAC in bytes.
  1. protected
  2. void
internalInit(java.security.Key key,java.security.spec.AlgorithmParameterSpec params)
Initializes the HMAC with the given secret key and algorithm parameters.
  1. protected
  2. void
internalReset()
Resets the HMAC for further use, maintaining the secret key that the HMAC was initialized with.
  1. protected
  2. void
internalUpdate(byte input)
Processes the given byte.
  1. protected
  2. void
internalUpdate(byte[] input,int offset,int len)
Processes the first len bytes in input, starting at offset.
  1. boolean
isFipsApproved()
  1. void
zeroize()
This function zeroizes the key so that it isn't in memory
Methods inherited from class javax.crypto.MacSpi
engineUpdate
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait

Constructor Detail

HmacSHA1

  1. public HmacSHA1()
  2. throws java.security.NoSuchAlgorithmException
Standard constructor, creates a new HmacSHA1 instance. Verify the JCE framework in the constructor.
Throws:
java.lang.SecurityException - if fails to verify the JCE framework.
java.security.NoSuchAlgorithmException

Method Detail

isFipsApproved

  1. public boolean isFipsApproved()
Description copied from interface: AlgorithmStatus
Module identifies if the cryptographic operation (algorithm) is FIPS certified
Specified by:
See Also:

engineGetMacLength

  1. protected int engineGetMacLength( )
Returns the length of the HMAC in bytes.
Specified by:
engineGetMacLength in class javax.crypto.MacSpi
Returns:
the HMAC length in bytes.
Throws:
FIPSRuntimeException - if SelfTest.isFipsRunnable returns false.

internalGetMacLength

  1. protected int internalGetMacLength( )
Returns the length of the HMAC in bytes.
Returns:
the HMAC length in bytes.

engineInit

  1. protected void engineInit(java.security.Key key,
  2. java.security.spec.AlgorithmParameterSpec params)
  3. throws java.security.InvalidKeyException
  4. java.security.InvalidAlgorithmParameterException
Initializes the HMAC with the given secret key and algorithm parameters.
Specified by:
engineInit in class javax.crypto.MacSpi
Parameters:
key - the secret key.
params - the algorithm parameters.
Throws:
java.security.InvalidKeyException - if the given key is inappropriate for initializing this MAC.
java.security.InvalidAlgorithmParameterException - if the given algorithm parameters are inappropriate for this MAC.
FIPSRuntimeException - if SelfTest.isFipsRunnable returns false.

internalInit

  1. protected void internalInit(java.security.Key key,
  2. java.security.spec.AlgorithmParameterSpec params)
  3. throws java.security.InvalidKeyException
  4. java.security.InvalidAlgorithmParameterException
Initializes the HMAC with the given secret key and algorithm parameters.
Parameters:
key - the secret key.
params - the algorithm parameters.
Throws:
java.security.InvalidKeyException - if the given key is inappropriate for initializing this MAC.
java.security.InvalidAlgorithmParameterException - if the given algorithm parameters are inappropriate for this MAC.

engineUpdate

  1. protected void engineUpdate(byte input)
Processes the given byte.
Specified by:
engineUpdate in class javax.crypto.MacSpi
Parameters:
input - the input byte to be processed.
Throws:
FIPSRuntimeException - if SelfTest.isFipsRunnable returns false.

internalUpdate

  1. protected void internalUpdate(byte input)
Processes the given byte.
Parameters:
input - the input byte to be processed.

engineUpdate

  1. protected void engineUpdate(byte[] input,
  2. int offset,
  3. int len)
Processes the first len bytes in input, starting at offset.
Specified by:
engineUpdate in class javax.crypto.MacSpi
Parameters:
input - the input buffer.
offset - the offset in input where the input starts.
len - the number of bytes to process.
Throws:
FIPSRuntimeException - if SelfTest.isFipsRunnable returns false.

internalUpdate

  1. protected void internalUpdate(byte[] input,
  2. int offset,
  3. int len)
Processes the first len bytes in input, starting at offset.
Parameters:
input - the input buffer.
offset - the offset in input where the input starts.
len - the number of bytes to process.

engineDoFinal

  1. protected byte[] engineDoFinal( )
Completes the HMAC computation and resets the HMAC for further use, maintaining the secret key that the HMAC was initialized with.
Specified by:
engineDoFinal in class javax.crypto.MacSpi
Returns:
the HMAC result.
Throws:
FIPSRuntimeException - if SelfTest.isFipsRunnable returns false.

internalDoFinal

  1. protected byte[] internalDoFinal( )
Completes the HMAC computation and resets the HMAC for further use, maintaining the secret key that the HMAC was initialized with.
Returns:
the HMAC result.

engineReset

  1. protected void engineReset()
Resets the HMAC for further use, maintaining the secret key that the HMAC was initialized with.
Specified by:
engineReset in class javax.crypto.MacSpi
Throws:
FIPSRuntimeException - if SelfTest.isFipsRunnable returns false.

internalReset

  1. protected void internalReset()
Resets the HMAC for further use, maintaining the secret key that the HMAC was initialized with.

clone

  1. public java.lang.Object clone()
Overrides:
clone in class javax.crypto.MacSpi

internalClone

  1. public java.lang.Object internalClone( )

zeroize

  1. public void zeroize()
This function zeroizes the key so that it isn't in memory

finalize

  1. protected void finalize()
This function zeroizes the key so that it isn't in memory when GC is done.
Overrides:
finalize in class java.lang.Object