public final class HelixMac extends MacSpi
Constructor and Description |
---|
HelixMac()
Creates a new HelixMac and performs the provider self-integrity
check.
|
Modifier and Type | Method and Description |
---|---|
protected byte[] |
engineDoFinal()
Completes the MAC computation and resets the MAC for further use,
maintaining the secret key that the MAC was initialized with.
|
protected int |
engineGetMacLength()
Returns the length of the MAC in bytes.
|
protected void |
engineInit(Key key,
AlgorithmParameterSpec params)
Initializes the MAC with the given (secret) key and algorithm parameters.
|
protected void |
engineReset()
Resets the MAC for further use, maintaining the secret key that the MAC
was initialized with.
|
protected void |
engineUpdate(byte input)
Processes the given byte.
|
protected void |
engineUpdate(byte[] input,
int offset,
int len)
Processes the first len bytes in input, starting at
offset inclusive.
|
clone, engineUpdate
public HelixMac()
protected int engineGetMacLength()
engineGetMacLength
in class MacSpi
MacSpi.engineGetMacLength()
protected void engineInit(Key key, AlgorithmParameterSpec params) throws InvalidKeyException, InvalidAlgorithmParameterException
If a MAC is non-null in params, it is ignored.
engineInit
in class MacSpi
key
- the secret key for an MAC generation (encryption) operation
(must be a Helix SecretKey
)params
- the algorithm parameters (must be a HelixParameterSpec
)InvalidKeyException
- if key is null or not a Helix
SecretKey
InvalidAlgorithmParameterException
- if params is null or not a
HelixParameterSpec
MacSpi.engineInit(java.security.Key,
java.security.spec.AlgorithmParameterSpec)
protected void engineUpdate(byte input)
engineUpdate
in class MacSpi
input
- the input byte to be processedMacSpi.engineUpdate(byte)
protected void engineUpdate(byte[] input, int offset, int len)
engineUpdate
in class MacSpi
input
- the input bufferoffset
- the index into input where the input bytes beginlen
- the number of bytes to be used from input (beginning at
offset)MacSpi.engineUpdate(byte[], int, int)
protected byte[] engineDoFinal()
engineDoFinal
in class MacSpi
MacSpi.engineDoFinal()
protected void engineReset()
The Helix nonce is also maintained. Re-using a HelixMac in this manner is not recommended; instead, re-initialize the Mac instance with a new nonce.
engineReset
in class MacSpi
MacSpi.engineReset()
Copyright © 2010-2015 Matthew Zipay. All Rights Reserved.