|
For the latest news and information visit The GNU Crypto project |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Object
|
+--gnu.crypto.mac.BaseMac
|
+--gnu.crypto.mac.HMac
The implementation of the HMAC (Keyed-Hash Message Authentication Code).
HMAC can be used in combination with any iterated cryptographic hash function. HMAC also uses a secret key for calculation and verification of the message authentication values. The main goals behind this construction are
References:
| Field Summary | |
protected int |
blockSize
|
protected byte[] |
ipad
|
protected IMessageDigest |
ipadHash
|
protected int |
macSize
|
protected IMessageDigest |
opadHash
|
| Fields inherited from class gnu.crypto.mac.BaseMac |
name, truncatedSize, underlyingHash |
| Fields inherited from interface gnu.crypto.mac.IMac |
MAC_KEY_MATERIAL, TRUNCATED_SIZE |
| Constructor Summary | |
protected |
HMac(IMessageDigest underlyingHash)
Trivial constructor for use by concrete subclasses. |
| Method Summary | |
java.lang.Object |
clone()
Returns a clone copy of this instance. |
byte[] |
digest()
Completes the MAC by performing final operations such as padding and resetting the instance. |
void |
init(java.util.Map attributes)
Initialises the algorithm with designated attributes. |
void |
reset()
Resets the algorithm instance for re-initialisation and use with other characteristics. |
boolean |
selfTest()
A basic test. |
| Methods inherited from class gnu.crypto.mac.BaseMac |
macSize, name, update, update |
| Methods inherited from class java.lang.Object |
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
protected int macSize
protected int blockSize
protected IMessageDigest ipadHash
protected IMessageDigest opadHash
protected byte[] ipad
| Constructor Detail |
protected HMac(IMessageDigest underlyingHash)
Trivial constructor for use by concrete subclasses.
underlyingHash - the underlying hash algorithm instance.| Method Detail |
public java.lang.Object clone()
IMacReturns a clone copy of this instance.
clone in interface IMacclone in class BaseMac
public void init(java.util.Map attributes)
throws java.security.InvalidKeyException,
java.lang.IllegalStateException
IMacInitialises the algorithm with designated attributes. Permissible names and values are described in the class documentation above.
init in interface IMacinit in class BaseMacattributes - a set of name-value pairs that describe the desired
future instance behaviour.
java.lang.IllegalStateException - if the instance is already initialised.
java.security.InvalidKeyException - if the key data is invalid.IMac.MAC_KEY_MATERIALpublic void reset()
IMacResets the algorithm instance for re-initialisation and use with other characteristics. This method always succeeds.
reset in interface IMacreset in class BaseMacpublic byte[] digest()
IMacCompletes the MAC by performing final operations such as padding and resetting the instance.
digest in interface IMacdigest in class BaseMacpublic boolean selfTest()
IMacA basic test. Ensures that the MAC of a pre-determined message is equal to a known pre-computed value.
selfTest in interface IMacselfTest in class BaseMactrue if the implementation passes a basic self-test.
Returns false otherwise.
|
For the latest news and information visit The GNU Crypto project |
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||