|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.netscape.cmsutil.util.HMACDigest
public class HMACDigest
This class implements the HMAC algorithm specified in RFC 2104 using any MessageDigest.
MessageDigest
Field Summary | |
---|---|
static int |
IPAD
|
static int |
OPAD
|
static int |
PAD_BYTES
|
Constructor Summary | |
---|---|
HMACDigest(java.security.MessageDigest md)
Creates an HMACDigest |
|
HMACDigest(java.security.MessageDigest md,
byte[] key)
Creates an HMACDigest and initializes the HMAC function with the given key. |
Method Summary | |
---|---|
java.lang.Object |
clone()
Clone the HMACDigest |
byte[] |
digest()
Completes the HMAC computation with the outer pad The digest is reset after this call is made. |
java.security.MessageDigest |
getMessageDigest()
Return the MessageDigest used for this HMAC |
void |
init(byte[] key)
Initialize the HMAC function The HMAC transform looks like: hash(key XOR opad, hash(key XOR ipad, text)) where key is an n byte key ipad is the byte 0x36 repeated 64 times opad is the byte 0x5c repeated 64 times and text is the data being protected This routine must be called after every reset. |
void |
reset()
Resets the digest for further use. |
void |
update(byte[] input)
Updates the digest using the specified array of bytes. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final int PAD_BYTES
public static final int IPAD
public static final int OPAD
Constructor Detail |
---|
public HMACDigest(java.security.MessageDigest md)
md
- The MessageDigest to be used for the HMAC calculation. It
must be clonable.public HMACDigest(java.security.MessageDigest md, byte[] key)
md
- The MessageDigest to be used for the HMAC calculation. It
must be clonable.key
- The key value to be used in the HMAC calculationMethod Detail |
---|
public java.security.MessageDigest getMessageDigest()
public void init(byte[] key)
key
- The password used to protect the hash valuepublic void update(byte[] input)
input
- the array of bytes.public byte[] digest()
public void reset()
public java.lang.Object clone() throws java.lang.CloneNotSupportedException
clone
in class java.lang.Object
java.lang.CloneNotSupportedException
- if this is called on a
MessageDigest implementation that does not support
Cloneable
.
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |