public class HMAC
extends java.lang.Object
| Constructor and Description |
|---|
HMAC(java.security.MessageDigest digest,
byte[] key)
Creates a new HMAC instance
|
HMAC(java.lang.String digestName,
byte[] key)
Creates a new HMAC instance
|
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Resets the HMAC object for further use
|
byte[] |
sign()
Signs the data (computes the secure hash)
|
void |
update(byte[] b)
Adds data to the current hash
|
void |
update(byte[] b,
int offset,
int length)
Adds data to the current hash
|
boolean |
verify(byte[] signature)
Verifies the data (computes the secure hash and compares it to the input)
|
public HMAC(java.security.MessageDigest digest,
byte[] key)
digest - The message digest object.key - The secret keypublic HMAC(java.lang.String digestName,
byte[] key)
digestName - The name of the message digest function.key - The secret key.public void update(byte[] b,
int offset,
int length)
b - The dataoffset - The index at which to start adding to the hashlength - The number of bytes to hashpublic void update(byte[] b)
b - The datapublic byte[] sign()
public boolean verify(byte[] signature)
signature - The signature to compare againstpublic void clear()