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 class
static final class
static final class
static final class
static final class
static final class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate NativeRef.HMAC_CTX
private final long
Holds 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 int
Holds the output size of the message digest. -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]
protected int
protected void
engineInit
(Key key, AlgorithmParameterSpec params) protected void
protected void
engineUpdate
(byte input) protected void
engineUpdate
(byte[] input, int offset, int len) protected void
engineUpdate
(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:
engineGetMacLength
in classMacSpi
-
engineInit
protected void engineInit(Key key, AlgorithmParameterSpec params) throws InvalidKeyException, InvalidAlgorithmParameterException - Specified by:
engineInit
in classMacSpi
- Throws:
InvalidKeyException
InvalidAlgorithmParameterException
-
resetContext
private final void resetContext() -
engineUpdate
protected void engineUpdate(byte input) - Specified by:
engineUpdate
in classMacSpi
-
engineUpdate
protected void engineUpdate(byte[] input, int offset, int len) - Specified by:
engineUpdate
in classMacSpi
-
engineUpdate
- Overrides:
engineUpdate
in classMacSpi
-
engineDoFinal
protected byte[] engineDoFinal()- Specified by:
engineDoFinal
in classMacSpi
-
engineReset
protected void engineReset()- Specified by:
engineReset
in classMacSpi
-