Top Fields Constructors Methods
org.conscrypt

public abstract Class OpenSSLEvpCipher

extends OpenSSLCipher
Class Inheritance
Known Direct Subclasses
org.conscrypt.OpenSSLEvpCipherAES, org.conscrypt.OpenSSLEvpCipherARC4, org.conscrypt.OpenSSLEvpCipherDESEDE
Annotations
@Internal
Imports
java.security.InvalidAlgorithmParameterException, .InvalidKeyException, .SecureRandom, java.security.spec.AlgorithmParameterSpec, javax.crypto.BadPaddingException, .IllegalBlockSizeException, .ShortBufferException, javax.crypto.spec.IvParameterSpec, org.conscrypt.NativeRef.EVP_CIPHER_CTX

Field Summary

Modifier and TypeField and Description
private boolean
calledUpdate

Whether the cipher has processed any data yet.

private final NativeRef.EVP_CIPHER_CTX
cipherCtx

Native pointer for the OpenSSL EVP_CIPHER context.

private int
modeBlockSize

The block size of the current mode.

Inherited from org.conscrypt.OpenSSLCipher:
encodedKeyivmode

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv int
doFinalInternal(byte[] output, int outputOffset, int maximumLen)

Implements abstract org.conscrypt.OpenSSLCipher.doFinalInternal.

API-specific implementation of the final block.
pack-priv void
engineInitInternal(byte[] encodedKey, AlgorithmParameterSpec params, SecureRandom random)

Implements abstract org.conscrypt.OpenSSLCipher.engineInitInternal.

API-specific implementation of initializing the cipher.
pack-priv abstract String
getCipherName(int keySize, OpenSSLCipher.Mode mode)

Returns the OpenSSL cipher name for the particular keySize and cipher mode.

pack-priv int
getOutputSizeForFinal(int inputLen)

Implements abstract org.conscrypt.OpenSSLCipher.getOutputSizeForFinal.

The size of output if doFinal() is called with this inputLen.
pack-priv int
getOutputSizeForUpdate(int inputLen)

Implements abstract org.conscrypt.OpenSSLCipher.getOutputSizeForUpdate.

The size of output if update() is called with this inputLen.
private void
reset()

Reset this Cipher instance state to process a new chunk of data.

pack-priv int
updateInternal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset, int maximumLen)

Implements abstract org.conscrypt.OpenSSLCipher.updateInternal.

API-specific implementation of updating the cipher.
Inherited from org.conscrypt.OpenSSLCipher:
checkSupportedKeySizecheckSupportedModecheckSupportedPaddingengineDoFinalengineDoFinalengineGetBlockSizeengineGetIVengineGetKeySizeengineGetOutputSizeengineGetParametersengineInitengineInitengineInitengineSetModeengineSetPaddingengineUnwrapengineUpdateengineUpdateengineWrapgetBaseCipherNamegetCipherBlockSizegetPaddinggetParameterSpecisEncryptingsupportsVariableSizeIvsupportsVariableSizeKey

Field Detail

calledUpdateback to summary
private boolean calledUpdate

Whether the cipher has processed any data yet. EVP_CIPHER doesn't like calling "doFinal()" in decryption mode without processing any updates.

cipherCtxback to summary
private final NativeRef.EVP_CIPHER_CTX cipherCtx

Native pointer for the OpenSSL EVP_CIPHER context.

modeBlockSizeback to summary
private int modeBlockSize

The block size of the current mode.

Constructor Detail

OpenSSLEvpCipherback to summary
public OpenSSLEvpCipher(OpenSSLCipher.Mode mode, OpenSSLCipher.Padding padding)

Method Detail

doFinalInternalback to summary
pack-priv int doFinalInternal(byte[] output, int outputOffset, int maximumLen) throws IllegalBlockSizeException, BadPaddingException, ShortBufferException

Implements abstract org.conscrypt.OpenSSLCipher.doFinalInternal.

Doc from org.conscrypt.OpenSSLCipher.doFinalInternal.

API-specific implementation of the final block. The maximumLen will be the maximum length of the possible output as returned by getOutputSizeForFinal(int). The return value must be the number of bytes processed and placed into output. On error, an exception must be thrown.

Annotations
@Override
engineInitInternalback to summary
pack-priv void engineInitInternal(byte[] encodedKey, AlgorithmParameterSpec params, SecureRandom random) throws InvalidKeyException, InvalidAlgorithmParameterException

Implements abstract org.conscrypt.OpenSSLCipher.engineInitInternal.

Doc from org.conscrypt.OpenSSLCipher.engineInitInternal.

API-specific implementation of initializing the cipher. The isEncrypting() function will tell whether it should be initialized for encryption or decryption. The encodedKey will be the bytes of a supported key size.

Annotations
@Override
getCipherNameback to summary
pack-priv abstract String getCipherName(int keySize, OpenSSLCipher.Mode mode)

Returns the OpenSSL cipher name for the particular keySize and cipher mode.

getOutputSizeForFinalback to summary
pack-priv int getOutputSizeForFinal(int inputLen)

Implements abstract org.conscrypt.OpenSSLCipher.getOutputSizeForFinal.

Doc from org.conscrypt.OpenSSLCipher.getOutputSizeForFinal.

The size of output if doFinal() is called with this inputLen. 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.

Annotations
@Override
getOutputSizeForUpdateback to summary
pack-priv int getOutputSizeForUpdate(int inputLen)

Implements abstract org.conscrypt.OpenSSLCipher.getOutputSizeForUpdate.

Doc from org.conscrypt.OpenSSLCipher.getOutputSizeForUpdate.

The size of output if update() is called with this inputLen. 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.

Annotations
@Override
resetback to summary
private void reset()

Reset this Cipher instance state to process a new chunk of data.

updateInternalback to summary
pack-priv int updateInternal(byte[] input, int inputOffset, int inputLen, byte[] output, int outputOffset, int maximumLen) throws ShortBufferException

Implements abstract org.conscrypt.OpenSSLCipher.updateInternal.

Doc from org.conscrypt.OpenSSLCipher.updateInternal.

API-specific implementation of updating the cipher. The maximumLen will be the maximum length of the output as returned by getOutputSizeForUpdate(int). The return value must be the number of bytes processed and placed into output. On error, an exception must be thrown.

Annotations
@Override