Package org.conscrypt
Class OpenSSLCipher.EVP_CIPHER
- java.lang.Object
-
- javax.crypto.CipherSpi
-
- org.conscrypt.OpenSSLCipher
-
- org.conscrypt.OpenSSLCipher.EVP_CIPHER
-
- Direct Known Subclasses:
OpenSSLCipher.EVP_CIPHER.AES,OpenSSLCipher.EVP_CIPHER.ARC4,OpenSSLCipher.EVP_CIPHER.DESEDE
- Enclosing class:
- OpenSSLCipher
public abstract static class OpenSSLCipher.EVP_CIPHER extends OpenSSLCipher
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classOpenSSLCipher.EVP_CIPHER.AESstatic classOpenSSLCipher.EVP_CIPHER.ARC4static classOpenSSLCipher.EVP_CIPHER.DESEDE-
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 booleancalledUpdateWhether the cipher has processed any data yet.-
Fields inherited from class org.conscrypt.OpenSSLCipher
encodedKey, iv, mode
-
-
Constructor Summary
Constructors Constructor Description EVP_CIPHER(OpenSSLCipher.Mode mode, OpenSSLCipher.Padding padding)
-
Method Summary
All Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description protected intdoFinalInternal(byte[] output, int outputOffset, int maximumLen)API-specific implementation of the final block.protected voidengineInitInternal(byte[] encodedKey, AlgorithmParameterSpec params, SecureRandom random)API-specific implementation of initializing the cipher.protected abstract StringgetCipherName(int keySize, OpenSSLCipher.Mode mode)Returns the OpenSSL cipher name for the particularkeySizeand ciphermode.protected intgetOutputSizeForFinal(int inputLen)The size of output ifdoFinal()is called with thisinputLen.protected intgetOutputSizeForUpdate(int inputLen)The size of output ifupdate()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, checkSupportedPadding, engineDoFinal, engineDoFinal, engineGetBlockSize, engineGetIV, engineGetOutputSize, engineGetParameters, engineInit, engineInit, engineInit, engineSetMode, engineSetPadding, engineUnwrap, engineUpdate, engineUpdate, engineWrap, getBaseCipherName, getCipherBlockSize, getPadding, isEncrypting, supportsVariableSizeIv, supportsVariableSizeKey
-
Methods inherited from class javax.crypto.CipherSpi
engineDoFinal, engineGetKeySize, engineUpdate, engineUpdateAAD, engineUpdateAAD
-
-
-
-
Constructor Detail
-
EVP_CIPHER
public EVP_CIPHER(OpenSSLCipher.Mode mode, OpenSSLCipher.Padding padding)
-
-
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, BadPaddingException, ShortBufferExceptionDescription 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:
IllegalBlockSizeExceptionBadPaddingExceptionShortBufferException
-
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
-
getOutputSizeForUpdate
protected int getOutputSizeForUpdate(int inputLen)
Description copied from class:OpenSSLCipherThe size of output ifupdate()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:
getOutputSizeForUpdatein classOpenSSLCipher
-
getCipherName
protected abstract String getCipherName(int keySize, OpenSSLCipher.Mode mode)
Returns the OpenSSL cipher name for the particularkeySizeand ciphermode.
-
-