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
@Internal public abstract class OpenSSLMac extends javax.crypto.MacSpi
An implementation ofMacwhich uses BoringSSL to perform all the operations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOpenSSLMac.HmacMD5static classOpenSSLMac.HmacSHA1static classOpenSSLMac.HmacSHA224static classOpenSSLMac.HmacSHA256static classOpenSSLMac.HmacSHA384static classOpenSSLMac.HmacSHA512
-
Field Summary
Fields Modifier and Type Field Description private NativeRef.HMAC_CTXctxprivate longevp_mdHolds the EVP_MD for the hashing algorithm, e.g.private byte[]keyBytesThe secret key used in this keyed MAC.private byte[]singleByteHolds a dummy buffer for writing single bytes to the digest.private intsizeHolds the output size of the message digest.
-
Constructor Summary
Constructors Modifier Constructor Description privateOpenSSLMac(long evp_md, int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]engineDoFinal()protected intengineGetMacLength()protected voidengineInit(java.security.Key key, java.security.spec.AlgorithmParameterSpec params)protected voidengineReset()protected voidengineUpdate(byte input)protected voidengineUpdate(byte[] input, int offset, int len)protected voidengineUpdate(java.nio.ByteBuffer input)private voidresetContext()
-
-
-
Field Detail
-
ctx
private NativeRef.HMAC_CTX ctx
-
evp_md
private final long evp_md
Holds the EVP_MD for the hashing algorithm, e.g. EVP_get_digestbyname("sha1");
-
keyBytes
private byte[] keyBytes
The secret key used in this keyed MAC.
-
size
private final int size
Holds the output size of the message digest.
-
singleByte
private final byte[] singleByte
Holds a dummy buffer for writing single bytes to the digest.
-
-
Method Detail
-
engineGetMacLength
protected int engineGetMacLength()
- Specified by:
engineGetMacLengthin classjavax.crypto.MacSpi
-
engineInit
protected void engineInit(java.security.Key key, java.security.spec.AlgorithmParameterSpec params) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException- Specified by:
engineInitin classjavax.crypto.MacSpi- Throws:
java.security.InvalidKeyExceptionjava.security.InvalidAlgorithmParameterException
-
resetContext
private final void resetContext()
-
engineUpdate
protected void engineUpdate(byte input)
- Specified by:
engineUpdatein classjavax.crypto.MacSpi
-
engineUpdate
protected void engineUpdate(byte[] input, int offset, int len)- Specified by:
engineUpdatein classjavax.crypto.MacSpi
-
engineUpdate
protected void engineUpdate(java.nio.ByteBuffer input)
- Overrides:
engineUpdatein classjavax.crypto.MacSpi
-
engineDoFinal
protected byte[] engineDoFinal()
- Specified by:
engineDoFinalin classjavax.crypto.MacSpi
-
engineReset
protected void engineReset()
- Specified by:
engineResetin classjavax.crypto.MacSpi
-
-