Top Description Fields Constructors Methods
org.conscrypt

public Class OpenSSLCipherChaCha20

extends OpenSSLCipher
Class Inheritance
Annotations
@Internal
Imports
java.security.InvalidAlgorithmParameterException, .InvalidKeyException, .NoSuchAlgorithmException, .SecureRandom, java.security.spec.AlgorithmParameterSpec, javax.crypto.BadPaddingException, .IllegalBlockSizeException, .NoSuchPaddingException, .ShortBufferException, javax.crypto.spec.IvParameterSpec

Implementation of the ChaCha20 stream cipher.

Field Summary

Modifier and TypeField and Description
private static final int
private int
private int
private static final int
Inherited from org.conscrypt.OpenSSLCipher:
encodedKeyivmode

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
pack-priv void
checkSupportedKeySize(int keySize)

Implements abstract org.conscrypt.OpenSSLCipher.checkSupportedKeySize.

Checks whether the cipher supports this particular keySize (in bytes) and throws InvalidKeyException if it doesn't.
pack-priv void
checkSupportedMode(OpenSSLCipher.Mode mode)

Implements abstract org.conscrypt.OpenSSLCipher.checkSupportedMode.

Checks whether the cipher supports this particular cipher mode and throws NoSuchAlgorithmException if it doesn't.
pack-priv void
checkSupportedPadding(OpenSSLCipher.Padding padding)

Implements abstract org.conscrypt.OpenSSLCipher.checkSupportedPadding.

Checks whether the cipher supports this particular cipher padding and throws NoSuchPaddingException if it doesn't.
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 String
getBaseCipherName()

Implements abstract org.conscrypt.OpenSSLCipher.getBaseCipherName.

Returns the standard name for the particular algorithm.
pack-priv int
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
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:
engineDoFinalengineDoFinalengineGetBlockSizeengineGetIVengineGetKeySizeengineGetOutputSizeengineGetParametersengineInitengineInitengineInitengineSetModeengineSetPaddingengineUnwrapengineUpdateengineUpdateengineWrapgetPaddinggetParameterSpecisEncryptingsupportsVariableSizeIvsupportsVariableSizeKey

Field Detail

BLOCK_SIZE_BYTESback to summary
private static final int BLOCK_SIZE_BYTES
blockCounterback to summary
private int blockCounter
currentBlockConsumedBytesback to summary
private int currentBlockConsumedBytes
NONCE_SIZE_BYTESback to summary
private static final int NONCE_SIZE_BYTES

Constructor Detail

OpenSSLCipherChaCha20back to summary
public OpenSSLCipherChaCha20()

Method Detail

checkSupportedKeySizeback to summary
pack-priv void checkSupportedKeySize(int keySize) throws InvalidKeyException

Implements abstract org.conscrypt.OpenSSLCipher.checkSupportedKeySize.

Doc from org.conscrypt.OpenSSLCipher.checkSupportedKeySize.

Checks whether the cipher supports this particular keySize (in bytes) and throws InvalidKeyException if it doesn't.

Annotations
@Override
checkSupportedModeback to summary
pack-priv void checkSupportedMode(OpenSSLCipher.Mode mode) throws NoSuchAlgorithmException

Implements abstract org.conscrypt.OpenSSLCipher.checkSupportedMode.

Doc from org.conscrypt.OpenSSLCipher.checkSupportedMode.

Checks whether the cipher supports this particular cipher mode and throws NoSuchAlgorithmException if it doesn't.

Annotations
@Override
checkSupportedPaddingback to summary
pack-priv void checkSupportedPadding(OpenSSLCipher.Padding padding) throws NoSuchPaddingException

Implements abstract org.conscrypt.OpenSSLCipher.checkSupportedPadding.

Doc from org.conscrypt.OpenSSLCipher.checkSupportedPadding.

Checks whether the cipher supports this particular cipher padding and throws NoSuchPaddingException if it doesn't.

Annotations
@Override
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
getBaseCipherNameback to summary
pack-priv String getBaseCipherName()

Implements abstract org.conscrypt.OpenSSLCipher.getBaseCipherName.

Doc from org.conscrypt.OpenSSLCipher.getBaseCipherName.

Returns the standard name for the particular algorithm.

Annotations
@Override
getCipherBlockSizeback to summary
pack-priv int getCipherBlockSize()

Implements abstract org.conscrypt.OpenSSLCipher.getCipherBlockSize.

Annotations
@Override
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()
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