Oracle Security Developer Tools Crypto Java API Reference
10g Release 2 (10.1.2.0.2)

B15565-01


oracle.security.crypto.core
Class HMAC

java.lang.Object
  extended byoracle.security.crypto.core.MessageDigest
      extended byoracle.security.crypto.core.HMAC

All Implemented Interfaces:
java.lang.Cloneable

public final class HMAC
extends MessageDigest

This class implements HMAC [RFC2104] as a subclass of MessageDigest. MD5 and SHA are supported.


Nested Class Summary

Nested classes inherited from class oracle.security.crypto.core.MessageDigest
MessageDigest.MDState

Field Summary

Fields inherited from class oracle.security.crypto.core.MessageDigest
algID, digestBits, digestValid

Constructor Summary
HMAC()
HMAC(AlgorithmIdentifier hashAlgID, byte[] key)
HMAC(AlgorithmIdentifier hashAlgID, byte[] key, int keyOff, int keyLen)

Method Summary
java.lang.String algName()
Returns the algorithm name of this HMAC.
int blockSize()
java.lang.Object clone()
Returns a clone of this HMAC object.
void computeCurrent()
Completes the hash computation, performing any necessary operations such as padding.
AlgorithmIdentifier getAlgID()
int getDigestLength()
Returns the length in bytes of the message digest.
protected MessageDigest.MDState getState()
void init()
Resets this HMAC object to its initial state.
void setAlgID(AlgorithmIdentifier algID)
void setKey(byte[] key)
void setKey(byte[] key, int keyOff, int keyLen)
protected void setState(MessageDigest.MDState state)
void update(byte b)
Adds the specifed byte to the data being digested.
void update(byte[] input, int off, int len)
Adds the specified sequence of bytes to the data being digested.

Methods inherited from class oracle.security.crypto.core.MessageDigest
computeDigest, computeDigest, getDigestBits, getInstance, isEqual, isEqual, toString, update, update, update, update, update, update, update, update, update, update, updateASCII

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

Constructor Detail

HMAC

public HMAC()

HMAC

public HMAC(AlgorithmIdentifier hashAlgID,
            byte[] key,
            int keyOff,
            int keyLen)
     throws AlgorithmIdentifierException

HMAC

public HMAC(AlgorithmIdentifier hashAlgID,
            byte[] key)
     throws AlgorithmIdentifierException

Method Detail

setAlgID

public void setAlgID(AlgorithmIdentifier algID)
              throws AlgorithmIdentifierException
Overrides:
setAlgID in class MessageDigest
Throws:
AlgorithmIdentifierException

getAlgID

public AlgorithmIdentifier getAlgID()
Specified by:
getAlgID in class MessageDigest

setKey

public void setKey(byte[] key,
                   int keyOff,
                   int keyLen)

setKey

public void setKey(byte[] key)

init

public void init()
Resets this HMAC object to its initial state.
Specified by:
init in class MessageDigest

update

public void update(byte b)
Adds the specifed byte to the data being digested.
Specified by:
update in class MessageDigest

update

public void update(byte[] input,
                   int off,
                   int len)
Adds the specified sequence of bytes to the data being digested.
Overrides:
update in class MessageDigest
Parameters:
input - the input array
off - start position in the input array
len - the number of input array elements to add to the data being digested

computeCurrent

public void computeCurrent()
Completes the hash computation, performing any necessary operations such as padding. The result of the hash can be retrieved using MessageDigest.getDigestBits().
Specified by:
computeCurrent in class MessageDigest

algName

public java.lang.String algName()
Returns the algorithm name of this HMAC. Possible name would be "HMAC-MD5" and "HMAC-SHA".
Specified by:
algName in class MessageDigest
Returns:
algorithm name

blockSize

public int blockSize()
Specified by:
blockSize in class MessageDigest

getDigestLength

public int getDigestLength()
Description copied from class: MessageDigest
Returns the length in bytes of the message digest.
Specified by:
getDigestLength in class MessageDigest

clone

public java.lang.Object clone()
Returns a clone of this HMAC object.
Specified by:
clone in class MessageDigest

getState

protected MessageDigest.MDState getState()
Specified by:
getState in class MessageDigest

setState

protected void setState(MessageDigest.MDState state)
Specified by:
setState in class MessageDigest

Oracle Security Developer Tools Crypto Java API Reference
10g Release 2 (10.1.2.0.2)

B15565-01


Copyright © 2005 , Oracle. All rights reserved.