public abstract class CBCMac
extends javax.crypto.MacSpi
The MAC length (Tlen) is the block size of the underlying cipher.
Modifier and Type | Class and Description |
---|---|
static class |
CBCMac.CBCMacAES
A CBCMAC that uses AES as block cipher.
|
static class |
CBCMac.CBCMacDES
A CBCMAC that uses DES as block cipher.
|
static class |
CBCMac.CBCMacDESede
A CBCMAC that uses DESede (Triple DES) as block 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