oracle.security.crypto.core
Class HMAC
java.lang.Object
oracle.security.crypto.core.MessageDigest
oracle.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.
| 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 |
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
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
Copyright © 2005 , Oracle. All rights reserved.