org.xbill.DNS.utils
Class hmacSigner
java.lang.Object
|
+--org.xbill.DNS.utils.hmacSigner
- public class hmacSigner
- extends Object
A pure java implementation of the HMAC-MD5 secure hash algorithm
|
Field Summary |
static boolean |
verbose
If true, all digested bytes will be printed |
|
Constructor Summary |
hmacSigner(byte[] key)
Creates a new HMAC instance |
|
Method Summary |
void |
addData(byte[] b)
Adds data to the current hash |
void |
addData(byte[] b,
int offset,
int length)
Adds data to the current hash |
void |
clear()
Resets the HMAC object for further use |
byte[] |
sign()
Signs the data (computes the secure hash) |
boolean |
verify(byte[] signature)
Verifies the data (computes the secure hash and compares it to the input) |
| Methods inherited from class java.lang.Object |
clone,
equals,
finalize,
getClass,
hashCode,
notify,
notifyAll,
toString,
wait,
wait,
wait |
verbose
public static boolean verbose
- If true, all digested bytes will be printed
hmacSigner
public hmacSigner(byte[] key)
- Creates a new HMAC instance
- Parameters:
key - The secret key
addData
public void addData(byte[] b,
int offset,
int length)
- Adds data to the current hash
- Parameters:
b - The datastart - The index at which to start adding to the hashlen - The number of bytes to hash
addData
public void addData(byte[] b)
- Adds data to the current hash
- Parameters:
b - The data
sign
public byte[] sign()
- Signs the data (computes the secure hash)
- Returns:
- An array with the signature
verify
public boolean verify(byte[] signature)
- Verifies the data (computes the secure hash and compares it to the input)
- Parameters:
signature - The signature to compare against- Returns:
- true if the signature matched, false otherwise
clear
public void clear()
- Resets the HMAC object for further use