Package org.conscrypt

Class OpenSSLMac

  • Direct Known Subclasses:
    OpenSSLMac.AesCmac, OpenSSLMac.Hmac

    @Internal
    public abstract class OpenSSLMac
    extends javax.crypto.MacSpi
    An implementation of Mac which uses BoringSSL to perform all the operations.
    • Field Detail

      • 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.
      • initialized

        protected boolean initialized
    • Constructor Detail

      • OpenSSLMac

        private OpenSSLMac​(int size)
    • 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:
        engineGetMacLength in class javax.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 class javax.crypto.MacSpi
        Throws:
        java.security.InvalidKeyException
        java.security.InvalidAlgorithmParameterException
      • engineUpdate

        protected void engineUpdate​(byte input)
        Specified by:
        engineUpdate in class javax.crypto.MacSpi
      • engineUpdate

        protected void engineUpdate​(java.nio.ByteBuffer input)
        Overrides:
        engineUpdate in class javax.crypto.MacSpi
      • engineDoFinal

        protected byte[] engineDoFinal()
        Specified by:
        engineDoFinal in class javax.crypto.MacSpi
      • doFinal

        protected abstract byte[] doFinal()
      • engineReset

        protected void engineReset()
        Specified by:
        engineReset in class javax.crypto.MacSpi