public abstract class CMac
extends javax.crypto.MacSpi
This base class can support block ciphers with a block size of 64 bit and 128 bit.
The MAC length (Tlen) is the block size of the underlying cipher.
Modifier and Type | Method and Description |
---|---|
protected byte[] |
engineDoFinal()
Calculate the MAC and reset this MAC object to be ready for further
MAC calculations.
|
protected int |
engineGetMacLength() |
protected void |
engineInit(java.security.Key key,
java.security.spec.AlgorithmParameterSpec params)
Initialize the MAC with the given key.
|
protected void |
engineReset()
Reset this MAC object to be ready for a new MAC computation.
|
protected void |
engineUpdate(byte input)
Feed a single byte into the MAC.
|
protected void |
engineUpdate(byte[] input,
int offset,
int len)
Feed in a block of bytes into this MAC.
|
protected int engineGetMacLength()
engineGetMacLength
in class javax.crypto.MacSpi
protected void engineInit(java.security.Key key, java.security.spec.AlgorithmParameterSpec params) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException
engineInit
in class javax.crypto.MacSpi
key
- The MAC key.params
- This implementation ignores this parameter.java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
protected void engineUpdate(byte input)
For better performance, use engineUpdate(byte[], int, int)
and feed in larger blocks.
engineUpdate
in class javax.crypto.MacSpi
input
- The input byte.protected void engineUpdate(byte[] input, int offset, int len)
engineUpdate
in class javax.crypto.MacSpi
input
- The data buffer.offset
- The start index in the buffer.len
- The length of the data block in the buffer.protected byte[] engineDoFinal()
engineDoFinal
in class javax.crypto.MacSpi
protected void engineReset()
engineReset
in class javax.crypto.MacSpi