Class BaseMac
java.lang.Object
javax.crypto.MacSpi
org.bouncycastle.jcajce.provider.symmetric.util.BaseMac
- All Implemented Interfaces:
PBE
- Direct Known Subclasses:
DES.CBCMAC,DES.DES64,DES.DES64with7816d4,DESede.CBCMAC,DESede.DESede64,DESede.DESede64with7816d4,MD5.HashMac,SHA1.HashMac,SHA1.SHA1Mac,SHA256.HashMac,SHA384.HashMac,SHA512.HashMac
public class BaseMac extends MacSpi implements PBE
-
Nested Class Summary
-
Field Summary
Fields inherited from interface org.bouncycastle.jcajce.provider.symmetric.util.PBE
MD5, OPENSSL, PKCS12, PKCS5S1, PKCS5S1_UTF8, PKCS5S2, PKCS5S2_UTF8, SHA1, SHA256 -
Constructor Summary
-
Method Summary
Modifier and Type Method Description protected byte[]engineDoFinal()Computes the digest of this MAC based on the data previously specified inMacSpi.engineUpdate(byte)calls.protected intengineGetMacLength()Returns the length of this MAC (in bytes).protected voidengineInit(Key key, AlgorithmParameterSpec params)Initializes thisMacSpiinstance with the specified key and algorithm parameters.protected voidengineReset()Resets thisMacSpiinstance to its initial state.protected voidengineUpdate(byte input)Updates thisMacSpiinstance with the specified byte.protected voidengineUpdate(byte[] input, int offset, int len)Updates thisMacSpiinstance with the data from the specified bufferinputfrom the specifiedoffsetand lengthlen.Methods inherited from class javax.crypto.MacSpi
clone, engineUpdate
-
Constructor Details
-
BaseMac
-
BaseMac
-
-
Method Details
-
engineInit
protected void engineInit(Key key, AlgorithmParameterSpec params) throws InvalidKeyException, InvalidAlgorithmParameterExceptionDescription copied from class:MacSpiInitializes thisMacSpiinstance with the specified key and algorithm parameters.- Specified by:
engineInitin classMacSpi- 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.
-
engineGetMacLength
protected int engineGetMacLength()Description copied from class:MacSpiReturns the length of this MAC (in bytes).- Specified by:
engineGetMacLengthin classMacSpi- Returns:
- the length of this MAC (in bytes).
-
engineReset
protected void engineReset()Description copied from class:MacSpiResets 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.- Specified by:
engineResetin classMacSpi
-
engineUpdate
protected void engineUpdate(byte input)Description copied from class:MacSpiUpdates thisMacSpiinstance with the specified byte.- Specified by:
engineUpdatein classMacSpi- Parameters:
input- the byte.
-
engineUpdate
protected void engineUpdate(byte[] input, int offset, int len)Description copied from class:MacSpiUpdates thisMacSpiinstance with the data from the specified bufferinputfrom the specifiedoffsetand lengthlen.- Specified by:
engineUpdatein classMacSpi- Parameters:
input- the buffer.offset- the offset in the buffer.len- the length of the data in the buffer.
-
engineDoFinal
protected byte[] engineDoFinal()Description copied from class:MacSpiComputes the digest of this MAC based on the data previously specified inMacSpi.engineUpdate(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.- Specified by:
engineDoFinalin classMacSpi- Returns:
- the generated digest.
-