gnu.crypto.mac
Class HMac
- Cloneable, IMac
public class HMac
implements Cloneable
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
- To use, without modifications, available hash functions. In
particular, hash functions that perform well in software, and for which
code is freely and widely available.
- To preserve the original performance of the hash function without
incurring a significant degradation.
- To use and handle keys in a simple way.
- To have a well understood cryptographic analysis of the strength of
the authentication mechanism based on reasonable assumptions on the
underlying hash function.
- To allow for easy replaceability of the underlying hash function in
case that faster or more secure hash functions are found or required.
References:
- RFC 2104HMAC:
Keyed-Hashing for Message Authentication.
H. Krawczyk, M. Bellare, and R. Canetti.
USE_WITH_PKCS5_V2
public static final String USE_WITH_PKCS5_V2
blockSize
protected int blockSize
ipad
protected byte[] ipad
macSize
protected int macSize
HMac
protected HMac(IMessageDigest underlyingHash)
Trivial constructor for use by concrete subclasses.
underlyingHash
- the underlying hash algorithm instance.
init
public void init(Map attributes)
throws InvalidKeyException,
IllegalStateException
- init in interface IMac
- init in interface BaseMac
Copyright © 2001, 2002, 2003
Free Software Foundation,
Inc. All Rights Reserved.