Top Fields Constructors Methods
org.bouncycastle.jcajce.provider

pack-priv Class BaseHMac

extends MacSpi
Class Inheritance
Imports
java.security.InvalidAlgorithmParameterException, .InvalidKeyException, .Key, java.security.spec.AlgorithmParameterSpec, javax.crypto.MacSpi, .SecretKey, javax.crypto.interfaces.PBEKey, javax.crypto.spec.PBEParameterSpec, .SecretKeySpec, org.bouncycastle.crypto.Algorithm, .AuthenticationParameters, .CryptoServicesRegistrar, .MACOperatorFactory, .OutputMACCalculator, .PasswordBasedDeriver, .UpdateOutputStream, org.bouncycastle.crypto.fips.FipsAlgorithm, .FipsMACOperatorFactory, .FipsSHS, org.bouncycastle.crypto.general.GeneralAlgorithm, .SecureHash, org.bouncycastle.jcajce.PKCS12Key

Field Summary

Modifier and TypeField and Description
private final Algorithm
private final MACOperatorFactory<T extends AuthenticationParameters<T extends Parameters>>
private static FipsMACOperatorFactory<FipsSHS.AuthParameters>
private static MACOperatorFactory<SecureHash.AuthParameters>
private OutputMACCalculator<T>
private UpdateOutputStream
private final MacParametersCreator<T extends AuthenticationParameters<T extends Parameters>>

Constructor Summary

AccessConstructor and Description
protected
BaseHMac(FipsAlgorithm algorithm, MacParametersCreator<T extends AuthenticationParameters<T extends Parameters>> parametersCreator)

protected
BaseHMac(GeneralAlgorithm algorithm, MacParametersCreator<T extends AuthenticationParameters<T extends Parameters>> parametersCreator)

Method Summary

Modifier and TypeMethod and Description
protected byte[]
engineDoFinal()

Implements abstract javax.crypto.MacSpi.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()

Implements abstract javax.crypto.MacSpi.engineGetMacLength.

Returns the length of the MAC in bytes.
protected void
engineInit(Key
the (secret) key.
key
,
AlgorithmParameterSpec
the algorithm parameters.
params
)

Implements abstract javax.crypto.MacSpi.engineInit.

Initializes the MAC with the given (secret) key and algorithm parameters.
protected void
engineReset()

Implements abstract javax.crypto.MacSpi.engineReset.

Resets the MAC for further use, maintaining the secret key that the MAC was initialized with.
protected void
engineUpdate(byte
the input byte to be processed.
input
)

Implements abstract javax.crypto.MacSpi.engineUpdate.

Processes the given byte.
protected void
engineUpdate(byte[]
the input buffer.
input
,
int
the offset in input where the input starts.
offset
,
int
the number of bytes to process.
len
)

Implements abstract javax.crypto.MacSpi.engineUpdate.

Processes the first len bytes in input, starting at offset inclusive.
private MACOperatorFactory<SecureHash.AuthParameters>
Inherited from javax.crypto.MacSpi:
cloneengineUpdate

Field Detail

algorithmback to summary
private final Algorithm algorithm
factoryback to summary
private final MACOperatorFactory<T extends AuthenticationParameters<T extends Parameters>> factory
fipsFactoryback to summary
private static FipsMACOperatorFactory<FipsSHS.AuthParameters> fipsFactory
generalFactoryback to summary
private static MACOperatorFactory<SecureHash.AuthParameters> generalFactory
macCalculatorback to summary
private OutputMACCalculator<T> macCalculator
macStreamback to summary
private UpdateOutputStream macStream
parametersCreatorback to summary
private final MacParametersCreator<T extends AuthenticationParameters<T extends Parameters>> parametersCreator

Constructor Detail

BaseHMacback to summary
protected BaseHMac(FipsAlgorithm algorithm, MacParametersCreator<T extends AuthenticationParameters<T extends Parameters>> parametersCreator)
BaseHMacback to summary
protected BaseHMac(GeneralAlgorithm algorithm, MacParametersCreator<T extends AuthenticationParameters<T extends Parameters>> parametersCreator)

Method Detail

engineDoFinalback to summary
protected byte[] engineDoFinal()

Implements abstract javax.crypto.MacSpi.engineDoFinal.

Doc from javax.crypto.MacSpi.engineDoFinal.

Completes the MAC computation and resets the MAC for further use, maintaining the secret key that the MAC was initialized with.

Returns:byte[]

the MAC result.

engineGetMacLengthback to summary
protected int engineGetMacLength()

Implements abstract javax.crypto.MacSpi.engineGetMacLength.

Doc from javax.crypto.MacSpi.engineGetMacLength.

Returns the length of the MAC in bytes.

Returns:int

the MAC length in bytes.

engineInitback to summary
protected void engineInit(Key key, AlgorithmParameterSpec params) throws InvalidKeyException, InvalidAlgorithmParameterException

Implements abstract javax.crypto.MacSpi.engineInit.

Doc from javax.crypto.MacSpi.engineInit.

Initializes the MAC with the given (secret) key and algorithm parameters.

Parameters
key:Key

the (secret) key.

params:AlgorithmParameterSpec

the algorithm parameters.

Exceptions
InvalidKeyException:
if the given key is inappropriate for initializing this MAC.
InvalidAlgorithmParameterException:
if the given algorithm parameters are inappropriate for this MAC.
engineResetback to summary
protected void engineReset()

Implements abstract javax.crypto.MacSpi.engineReset.

Doc from javax.crypto.MacSpi.engineReset.

Resets the MAC for further use, maintaining the secret key that the MAC was initialized with.

engineUpdateback to summary
protected void engineUpdate(byte input)

Implements abstract javax.crypto.MacSpi.engineUpdate.

Doc from javax.crypto.MacSpi.engineUpdate.

Processes the given byte.

Parameters
input:byte

the input byte to be processed.

engineUpdateback to summary
protected void engineUpdate(byte[] input, int offset, int len)

Implements abstract javax.crypto.MacSpi.engineUpdate.

Doc from javax.crypto.MacSpi.engineUpdate.

Processes the first len bytes in input, starting at offset inclusive.

Parameters
input:byte[]

the input buffer.

offset:int

the offset in input where the input starts.

len:int

the number of bytes to process.

getGeneralMACFactoryback to summary
private MACOperatorFactory<SecureHash.AuthParameters> getGeneralMACFactory()