|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.xbill.DNS.utils.HMAC
public class HMAC
An implementation of the HMAC message authentication code.
Constructor Summary | |
---|---|
HMAC(MessageDigest digest,
byte[] key)
Deprecated. won't work with digests using a padding length other than 64; use HMAC(MessageDigest digest, int blockLength,
byte [] key) instead. |
|
HMAC(MessageDigest digest,
int blockLength,
byte[] key)
Creates a new HMAC instance |
|
HMAC(String digestName,
byte[] key)
Deprecated. won't work with digests using a padding length other than 64; use HMAC(String digestName, int blockLength, byte [] key)
instead |
|
HMAC(String digestName,
int blockLength,
byte[] key)
Creates a new HMAC instance |
Method Summary | |
---|---|
void |
clear()
Resets the HMAC object for further use |
int |
digestLength()
Returns the length of the digest. |
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) |
boolean |
verify(byte[] signature,
boolean truncation_ok)
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 |
Constructor Detail |
---|
public HMAC(MessageDigest digest, int blockLength, byte[] key)
digest
- The message digest object.blockLength
- The block length of the message digest.key
- The secret keypublic HMAC(String digestName, int blockLength, byte[] key)
digestName
- The name of the message digest function.blockLength
- The block length of the message digest.key
- The secret key.public HMAC(MessageDigest digest, byte[] key)
HMAC(MessageDigest digest, int blockLength,
byte [] key)
instead.
digest
- The message digest object.key
- The secret keyHMAC(MessageDigest digest, int blockLength, byte [] key)
public HMAC(String digestName, byte[] key)
HMAC(String digestName, int blockLength, byte [] key)
instead
digestName
- The name of the message digest function.key
- The secret key.HMAC(String digestName, int blockLength, byte [] key)
Method Detail |
---|
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 against
public boolean verify(byte[] signature, boolean truncation_ok)
signature
- The signature to compare againsttruncation_ok
- If true, the signature may be truncated; only the
number of bytes in the provided signature are compared.
public void clear()
public int digestLength()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |