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 ofMac
which uses BoringSSL to perform all the operations.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
OpenSSLMac.HmacMD5
static class
OpenSSLMac.HmacSHA1
static class
OpenSSLMac.HmacSHA224
static class
OpenSSLMac.HmacSHA256
static class
OpenSSLMac.HmacSHA384
static class
OpenSSLMac.HmacSHA512
-
Field Summary
Fields Modifier and Type Field Description private NativeRef.HMAC_CTX
ctx
private long
evp_md
Holds the EVP_MD for the hashing algorithm, e.g.private byte[]
keyBytes
The secret key used in this keyed MAC.private byte[]
singleByte
Holds a dummy buffer for writing single bytes to the digest.private int
size
Holds the output size of the message digest.
-
Constructor Summary
Constructors Modifier Constructor Description private
OpenSSLMac(long evp_md, int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected byte[]
engineDoFinal()
protected int
engineGetMacLength()
protected void
engineInit(java.security.Key key, java.security.spec.AlgorithmParameterSpec params)
protected void
engineReset()
protected void
engineUpdate(byte input)
protected void
engineUpdate(byte[] input, int offset, int len)
protected void
engineUpdate(java.nio.ByteBuffer input)
private void
resetContext()
-
-
-
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:
engineGetMacLength
in 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:
engineInit
in classjavax.crypto.MacSpi
- Throws:
java.security.InvalidKeyException
java.security.InvalidAlgorithmParameterException
-
resetContext
private final void resetContext()
-
engineUpdate
protected void engineUpdate(byte input)
- Specified by:
engineUpdate
in classjavax.crypto.MacSpi
-
engineUpdate
protected void engineUpdate(byte[] input, int offset, int len)
- Specified by:
engineUpdate
in classjavax.crypto.MacSpi
-
engineUpdate
protected void engineUpdate(java.nio.ByteBuffer input)
- Overrides:
engineUpdate
in classjavax.crypto.MacSpi
-
engineDoFinal
protected byte[] engineDoFinal()
- Specified by:
engineDoFinal
in classjavax.crypto.MacSpi
-
engineReset
protected void engineReset()
- Specified by:
engineReset
in classjavax.crypto.MacSpi
-
-