Package org.conscrypt
Class OpenSSLMac
java.lang.Object
javax.crypto.MacSpi
org.conscrypt.OpenSSLMac
- Direct Known Subclasses:
OpenSSLMac.HmacMD5,OpenSSLMac.HmacSHA1,OpenSSLMac.HmacSHA224,OpenSSLMac.HmacSHA256,OpenSSLMac.HmacSHA384,OpenSSLMac.HmacSHA512
An implementation of
Mac which uses BoringSSL to perform all the operations.-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic final classstatic final classstatic final classstatic final classstatic final classstatic final class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate NativeRef.HMAC_CTXprivate final longHolds the EVP_MD for the hashing algorithm, e.g.private byte[]The secret key used in this keyed MAC.private final byte[]Holds a dummy buffer for writing single bytes to the digest.private final intHolds the output size of the message digest. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]protected intprotected voidengineInit(Key key, AlgorithmParameterSpec params) protected voidprotected voidengineUpdate(byte input) protected voidengineUpdate(byte[] input, int offset, int len) protected voidengineUpdate(ByteBuffer input) private final void
-
Field Details
-
ctx
-
evp_md
private final long evp_mdHolds the EVP_MD for the hashing algorithm, e.g. EVP_get_digestbyname("sha1"); -
keyBytes
private byte[] keyBytesThe secret key used in this keyed MAC. -
size
private final int sizeHolds the output size of the message digest. -
singleByte
private final byte[] singleByteHolds a dummy buffer for writing single bytes to the digest.
-
-
Constructor Details
-
OpenSSLMac
private OpenSSLMac(long evp_md, int size)
-
-
Method Details
-
engineGetMacLength
protected int engineGetMacLength()- Specified by:
engineGetMacLengthin classMacSpi
-
engineInit
protected void engineInit(Key key, AlgorithmParameterSpec params) throws InvalidKeyException, InvalidAlgorithmParameterException - Specified by:
engineInitin classMacSpi- Throws:
InvalidKeyExceptionInvalidAlgorithmParameterException
-
resetContext
private final void resetContext() -
engineUpdate
protected void engineUpdate(byte input) - Specified by:
engineUpdatein classMacSpi
-
engineUpdate
protected void engineUpdate(byte[] input, int offset, int len) - Specified by:
engineUpdatein classMacSpi
-
engineUpdate
- Overrides:
engineUpdatein classMacSpi
-
engineDoFinal
protected byte[] engineDoFinal()- Specified by:
engineDoFinalin classMacSpi
-
engineReset
protected void engineReset()- Specified by:
engineResetin classMacSpi
-