Package org.conscrypt
Class OpenSSLMac
- java.lang.Object
-
- javax.crypto.MacSpi
-
- org.conscrypt.OpenSSLMac
-
- Direct Known Subclasses:
OpenSSLMac.AesCmac,OpenSSLMac.Hmac
@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.AesCmacstatic classOpenSSLMac.Hmacstatic classOpenSSLMac.HmacMD5static classOpenSSLMac.HmacSHA1static classOpenSSLMac.HmacSHA224static classOpenSSLMac.HmacSHA256static classOpenSSLMac.HmacSHA384static classOpenSSLMac.HmacSHA512
-
Field Summary
Fields Modifier and Type Field Description protected booleaninitializedprivate 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(int size)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected abstract byte[]doFinal()protected byte[]engineDoFinal()protected intengineGetMacLength()protected voidengineInit(java.security.Key key, java.security.spec.AlgorithmParameterSpec params)protected voidengineReset()protected voidengineUpdate(byte input)protected voidengineUpdate(java.nio.ByteBuffer input)protected abstract voidinitContext(byte[] keyBytes)Creates and initializes the relevant BoringSSL *MAC context.protected abstract voidresetContext()Resets the context for a new operation with the same key.protected abstract voidupdateDirect(long ptr, int len)Passes the contents of a direct ByteBuffer to the relevant BoringSSL *MAC function.
-
-
-
Method Detail
-
initContext
protected abstract void initContext(byte[] keyBytes)
Creates and initializes the relevant BoringSSL *MAC context.
-
resetContext
protected abstract void resetContext()
Resets the context for a new operation with the same key.
-
updateDirect
protected abstract void updateDirect(long ptr, int len)Passes the contents of a direct ByteBuffer to the relevant BoringSSL *MAC function.
-
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
-
engineUpdate
protected void engineUpdate(byte input)
- 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
-
doFinal
protected abstract byte[] doFinal()
-
engineReset
protected void engineReset()
- Specified by:
engineResetin classjavax.crypto.MacSpi
-
-