Package javax.crypto
Class MacSpi
java.lang.Object
javax.crypto.MacSpi
- Direct Known Subclasses:
BaseMac,OpenSSLMac
public abstract class MacSpi extends Object
The Service-Provider Interface (SPI) definition for the
Mac class.- See Also:
Mac
-
Constructor Summary
Constructors Constructor Description MacSpi()Creates a newMacSpiinstance. -
Method Summary
Modifier and Type Method Description Objectclone()Clones thisMacSpiinstance.protected abstract byte[]engineDoFinal()Computes the digest of this MAC based on the data previously specified inengineUpdate(byte)calls.protected abstract intengineGetMacLength()Returns the length of this MAC (in bytes).protected abstract voidengineInit(Key key, AlgorithmParameterSpec params)Initializes thisMacSpiinstance with the specified key and algorithm parameters.protected abstract voidengineReset()Resets thisMacSpiinstance to its initial state.protected abstract voidengineUpdate(byte input)Updates thisMacSpiinstance with the specified byte.protected abstract voidengineUpdate(byte[] input, int offset, int len)Updates thisMacSpiinstance with the data from the specified bufferinputfrom the specifiedoffsetand lengthlen.protected voidengineUpdate(ByteBuffer input)Updates thisMacSpiinstance with the data from the specified buffer, starting atBuffer.position(), including the nextBuffer.remaining()bytes.
-
Constructor Details
-
MacSpi
public MacSpi()Creates a newMacSpiinstance.
-
-
Method Details
-
engineGetMacLength
protected abstract int engineGetMacLength()Returns the length of this MAC (in bytes).- Returns:
- the length of this MAC (in bytes).
-
engineInit
protected abstract void engineInit(Key key, AlgorithmParameterSpec params) throws InvalidKeyException, InvalidAlgorithmParameterExceptionInitializes thisMacSpiinstance with the specified key and algorithm parameters.- Parameters:
key- the key to initialize this algorithm.params- the parameters for this algorithm.- Throws:
InvalidKeyException- if the specified key cannot be used to initialize this algorithm, or it isnull.InvalidAlgorithmParameterException- if the specified parameters cannot be used to initialize this algorithm.
-
engineUpdate
protected abstract void engineUpdate(byte input)Updates thisMacSpiinstance with the specified byte.- Parameters:
input- the byte.
-
engineUpdate
protected abstract void engineUpdate(byte[] input, int offset, int len)Updates thisMacSpiinstance with the data from the specified bufferinputfrom the specifiedoffsetand lengthlen.- Parameters:
input- the buffer.offset- the offset in the buffer.len- the length of the data in the buffer.
-
engineUpdate
Updates thisMacSpiinstance with the data from the specified buffer, starting atBuffer.position(), including the nextBuffer.remaining()bytes.- Parameters:
input- the buffer.
-
engineDoFinal
protected abstract byte[] engineDoFinal()Computes the digest of this MAC based on the data previously specified inengineUpdate(byte)calls.This
MacSpiinstance is reverted to its initial state and can be used to start the next MAC computation with the same parameters or initialized with different parameters.- Returns:
- the generated digest.
-
engineReset
protected abstract void engineReset()Resets thisMacSpiinstance to its initial state.This
MacSpiinstance is reverted to its initial state and can be used to start the next MAC computation with the same parameters or initialized with different parameters. -
clone
Clones thisMacSpiinstance.- Overrides:
clonein classObject- Returns:
- the cloned instance.
- Throws:
CloneNotSupportedException- if cloning is not supported.
-