| Modifier and Type | Field and Description |
|---|---|
protected java.lang.String |
name
The canonical name prefix of the MAC.
|
protected int |
truncatedSize
The length of the truncated output in bytes.
|
protected IMessageDigest |
underlyingHash
Reference to the underlying hash algorithm instance.
|
MAC_KEY_MATERIAL, TRUNCATED_SIZE| Modifier | Constructor and Description |
|---|---|
protected |
BaseMac(java.lang.String name)
Trivial constructor for use by concrete subclasses.
|
protected |
BaseMac(java.lang.String name,
IMessageDigest underlyingHash)
Trivial constructor for use by concrete subclasses.
|
| Modifier and Type | Method and Description |
|---|---|
abstract java.lang.Object |
clone()
Returns a clone copy of this instance.
|
abstract byte[] |
digest()
Completes the MAC by performing final operations such as
padding and resetting the instance.
|
abstract void |
init(java.util.Map attributes)
Initialises the algorithm with designated attributes.
|
int |
macSize()
Returns the output length in bytes of this MAC algorithm.
|
java.lang.String |
name()
Returns the canonical name of this algorithm.
|
void |
reset()
Resets the algorithm instance for re-initialisation and use with other
characteristics.
|
abstract boolean |
selfTest()
A basic test.
|
void |
update(byte b)
Continues a MAC operation using the input byte.
|
void |
update(byte[] b,
int offset,
int len)
Continues a MAC operation, by filling the buffer, processing
data in the algorithm's MAC_SIZE-bit block(s), updating the context and
count, and buffering the remaining bytes in buffer for the next
operation.
|
protected java.lang.String name
protected IMessageDigest underlyingHash
protected int truncatedSize
protected BaseMac(java.lang.String name)
Trivial constructor for use by concrete subclasses.
name - the canonical name of this instance.protected BaseMac(java.lang.String name,
IMessageDigest underlyingHash)
Trivial constructor for use by concrete subclasses.
name - the canonical name of this instance.underlyingHash - the underlying message digest algorithm instance.public java.lang.String name()
IMacReturns the canonical name of this algorithm.
public int macSize()
IMacReturns the output length in bytes of this MAC algorithm.
public void update(byte b)
IMacContinues a MAC operation using the input byte.
public void update(byte[] b,
int offset,
int len)
IMacContinues a MAC operation, by filling the buffer, processing data in the algorithm's MAC_SIZE-bit block(s), updating the context and count, and buffering the remaining bytes in buffer for the next operation.
public void reset()
IMacResets the algorithm instance for re-initialisation and use with other characteristics. This method always succeeds.
public abstract java.lang.Object clone()
IMacReturns a clone copy of this instance.
public abstract 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 IMacattributes - a set of name-value pairs that describe the desired
future instance behaviour.java.security.InvalidKeyException - if the key data is invalid.java.lang.IllegalStateException - if the instance is already initialised.IMac.MAC_KEY_MATERIALpublic abstract byte[] digest()
IMacCompletes the MAC by performing final operations such as padding and resetting the instance.
public abstract boolean selfTest()
IMacA basic test. Ensures that the MAC of a pre-determined message is equal to a known pre-computed value.
Copyright © 2025. All rights reserved.