Package org.conscrypt
Class OpenSSLCipher.EVP_AEAD
- java.lang.Object
-
- javax.crypto.CipherSpi
-
- org.conscrypt.OpenSSLCipher
-
- org.conscrypt.OpenSSLCipher.EVP_AEAD
-
- Direct Known Subclasses:
OpenSSLCipher.EVP_AEAD.AES
- Enclosing class:
- OpenSSLCipher
public abstract static class OpenSSLCipher.EVP_AEAD extends OpenSSLCipher
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOpenSSLCipher.EVP_AEAD.AES-
Nested classes/interfaces inherited from class org.conscrypt.OpenSSLCipher
OpenSSLCipher.EVP_AEAD, OpenSSLCipher.EVP_CIPHER, OpenSSLCipher.Mode, OpenSSLCipher.Padding
-
-
Field Summary
Fields Modifier and Type Field Description protected byte[]bufThe byte array containing the bytes written.protected intbufCountThe number of bytes written.protected longevpAeadAEAD cipher reference.-
Fields inherited from class org.conscrypt.OpenSSLCipher
encodedKey, iv, mode
-
-
Constructor Summary
Constructors Constructor Description EVP_AEAD(OpenSSLCipher.Mode mode)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected voidcheckSupportedPadding(OpenSSLCipher.Padding padding)Checks whether the cipher supports this particular cipherpaddingand throwsNoSuchPaddingExceptionif it doesn't.protected intdoFinalInternal(byte[] output, int outputOffset, int maximumLen)API-specific implementation of the final block.protected AlgorithmParametersengineGetParameters()Returns the parameters that where used to create this cipher instance.protected voidengineInitInternal(byte[] encodedKey, AlgorithmParameterSpec params, SecureRandom random)API-specific implementation of initializing the cipher.protected voidengineUpdateAAD(byte[] input, int inputOffset, int inputLen)Continues a multi-part transformation (encryption or decryption) with Authenticated Additional Data (AAD).protected abstract longgetEVP_AEAD(int keyLength)protected intgetOutputSizeForFinal(int inputLen)The size of output ifdoFinal()is called with thisinputLen.protected intupdateInternal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset, int maximumLen)API-specific implementation of updating the cipher.-
Methods inherited from class org.conscrypt.OpenSSLCipher
checkSupportedKeySize, checkSupportedMode, engineDoFinal, engineDoFinal, engineGetBlockSize, engineGetIV, engineGetOutputSize, engineInit, engineInit, engineInit, engineSetMode, engineSetPadding, engineUnwrap, engineUpdate, engineUpdate, engineWrap, getBaseCipherName, getCipherBlockSize, getOutputSizeForUpdate, getPadding, isEncrypting, supportsVariableSizeIv, supportsVariableSizeKey
-
Methods inherited from class javax.crypto.CipherSpi
engineDoFinal, engineGetKeySize, engineUpdate, engineUpdateAAD
-
-
-
-
Constructor Detail
-
EVP_AEAD
public EVP_AEAD(OpenSSLCipher.Mode mode)
-
-
Method Detail
-
engineInitInternal
protected void engineInitInternal(byte[] encodedKey, AlgorithmParameterSpec params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterExceptionDescription copied from class:OpenSSLCipherAPI-specific implementation of initializing the cipher. TheOpenSSLCipher.isEncrypting()function will tell whether it should be initialized for encryption or decryption. TheencodedKeywill be the bytes of a supported key size.- Specified by:
engineInitInternalin classOpenSSLCipher- Throws:
InvalidKeyExceptionInvalidAlgorithmParameterException
-
updateInternal
protected int updateInternal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset, int maximumLen) throws ShortBufferExceptionDescription copied from class:OpenSSLCipherAPI-specific implementation of updating the cipher. ThemaximumLenwill be the maximum length of the output as returned byOpenSSLCipher.getOutputSizeForUpdate(int). The return value must be the number of bytes processed and placed intooutput. On error, an exception must be thrown.- Specified by:
updateInternalin classOpenSSLCipher- Throws:
ShortBufferException
-
doFinalInternal
protected int doFinalInternal(byte[] output, int outputOffset, int maximumLen) throws IllegalBlockSizeException, BadPaddingExceptionDescription copied from class:OpenSSLCipherAPI-specific implementation of the final block. ThemaximumLenwill be the maximum length of the possible output as returned byOpenSSLCipher.getOutputSizeForFinal(int). The return value must be the number of bytes processed and placed intooutput. On error, an exception must be thrown.- Specified by:
doFinalInternalin classOpenSSLCipher- Throws:
IllegalBlockSizeExceptionBadPaddingException
-
checkSupportedPadding
protected void checkSupportedPadding(OpenSSLCipher.Padding padding) throws NoSuchPaddingException
Description copied from class:OpenSSLCipherChecks whether the cipher supports this particular cipherpaddingand throwsNoSuchPaddingExceptionif it doesn't.- Specified by:
checkSupportedPaddingin classOpenSSLCipher- Throws:
NoSuchPaddingException
-
getOutputSizeForFinal
protected int getOutputSizeForFinal(int inputLen)
Description copied from class:OpenSSLCipherThe size of output ifdoFinal()is called with thisinputLen. If padding is enabled and the size of the input puts it right at the block size, it will add another block for the padding.- Specified by:
getOutputSizeForFinalin classOpenSSLCipher
-
engineUpdateAAD
protected void engineUpdateAAD(byte[] input, int inputOffset, int inputLen)Description copied from class:CipherSpiContinues a multi-part transformation (encryption or decryption) with Authenticated Additional Data (AAD). AAD may only be added after theCipheris initialized and before any data is passed to the instance.This is only usable with cipher modes that support Authenticated Encryption with Additional Data (AEAD) such as Galois/Counter Mode (GCM).
- Overrides:
engineUpdateAADin classCipherSpi- Parameters:
input- bytes of AAD to use with the cipherinputOffset- offset within bytes of additional data to add to cipherinputLen- length of bytes of additional data to add to cipher
-
engineGetParameters
protected AlgorithmParameters engineGetParameters()
Description copied from class:CipherSpiReturns the parameters that where used to create this cipher instance.These may be a the same parameters that were used to create this cipher instance, or may be a combination of default and random parameters, depending on the underlying cipher implementation.
- Overrides:
engineGetParametersin classOpenSSLCipher- Returns:
- the parameters that where used to create this cipher instance, or
nullif this cipher instance does not have any parameters at all.
-
getEVP_AEAD
protected abstract long getEVP_AEAD(int keyLength) throws InvalidKeyException- Throws:
InvalidKeyException
-
-