| Modifier and Type | Class and Description |
|---|---|
| public static class | |
| public static class | |
| pack-priv static interface | ChaCha20Cipher.
Interface for the underlying processing engines for ChaCha20 |
| private class | |
| private class | |
| private class |
| Modifier and Type | Field and Description |
|---|---|
| private boolean | |
| private long | |
| private static final VarHandle | |
| private static final VarHandle | |
| private static final VarHandle | |
| protected String | |
| private Poly1305 | |
| private long | |
| private long | |
| private int | |
| private ChaCha20Cipher. | |
| private long | |
| private long | |
| private boolean | |
| private byte[] | |
| private final byte[] | |
| private int | |
| private int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private final byte[] | |
| private static final long | |
| protected int | |
| private static final int | |
| private static final int | |
| private byte[] | |
| private static final byte[] | |
| private final int[] | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int | |
| private static final int |
| Access | Constructor and Description |
|---|---|
| protected |
| Modifier and Type | Method and Description |
|---|---|
| private void | authFinalizeData(byte[]
an array containing any remaining data to process. data, int the offset into the data. dataOff, int the length of the data to process. length, byte[] the array to write the resulting tag into out, int the offset to begin writing the data. outOff)Finalize the data and return the tag. |
| private void | authPad16(long
the starting length to be padded. dataLen)Based on a given length of data, make the authenticator process zero bytes that will pad the length out to a multiple of 16. |
| private int | Returns: the number of bytes processed by this method.the data to stir into the authenticator. data, int the offset into the data. offset, int the length of data to add to the authenticator. length)Update the authenticator state with data. |
| private void | authWriteLengths(long
the length of the AAD. aLen, long the length of the application data. dLen, byte[] the buffer to write the two lengths into. buf)Write the two 64-bit little-endian length fields into an array for processing by the poly1305 authenticator. |
| private int | bufferCrypt(ByteBuffer input, ByteBuffer output, boolean isUpdate)
Hides javax. Implementation for encryption using ByteBuffers. |
| private static int | |
| private void | chaCha20Transform(byte[]
the array of bytes for the input in, int the offset into the input array to start the transform inOff, int the length of the data to perform the transform on. inLen, byte[] the output array. It must be large enough to hold the
resulting data out, int the offset into the output array to place the resulting
data. outOff)Perform the ChaCha20 transform. |
| private void | checkKeyAndNonce(byte[]
the byte encoding for the newly provided key newKeyBytes, byte[] the new nonce to be used with this initialization newNonce)Check the key and nonce bytes to make sure that they do not repeat across reinitialization. |
| private static byte[] | Returns: a 12-byte array containing the random nonce.a random)SecureRandom object. If null is
provided a new SecureRandom object will be instantiated.Create a random 12-byte nonce. |
| protected byte[] | Returns: the resulting plaintext or ciphertext bytes (depending on the operation type)the plaintext or ciphertext input bytes (depending on the
operation type). in, int the offset into the input array inOfs, int the length of the data to use for the update operation. inLen)Implements abstract javax. Complete the currently running operation using any final data provided by the caller. |
| protected int | Returns: the length in bytes of the data written into theout
buffer.the plaintext or ciphertext input bytes (depending on the
operation type). in, int the offset into the input array inOfs, int the length of the data to use for the update operation. inLen, byte[] the byte array that will hold the resulting data. The array
must be large enough to hold the resulting data. out, int the offset for the outOfs)out buffer to begin writing
the resulting data.Implements abstract javax. Complete the currently running operation using any final data provided by the caller. |
| protected int | Returns: the resulting plaintext or ciphertext bytes.the plaintext or ciphertext input bytebuffer. input, ByteBuffer ByteBuffer that will hold the resulting data. This
must be large enough to hold the resulting data. output)Overrides javax. Complete the currently running operation using any final data provided by the caller. |
| protected int | Returns: This method always returns 0. See the JCE Specification.Implements abstract javax. Returns the block size. |
| protected byte[] | Returns: the nonce bytes. For ChaCha20 this will be a 12-byte value.Implements abstract javax. Get the nonce value used. |
| protected int | Returns: the length of the key in bitsthe key to be evaluated key)Overrides javax. Get the length of a provided key in bits. |
| protected int | Returns: the output length in bytes.the length in bytes of the input inputLen)Implements abstract javax. Get the output size required to hold the result of the next update or doFinal operation. |
| protected AlgorithmParameters | Returns: anull value if the ChaCha20 cipher is used (mode is
MODE_NONE), or a ChaCha20Poly1305Parameters object containing
the nonce if the mode is MODE_AEAD.Implements abstract javax. Get the algorithm parameters for this cipher. |
| protected void | engineInit(int
the type of operation to do. This value may not be
opmode, Key Cipher.DECRYPT_MODE or Cipher.UNWRAP_MODE mode
because it must generate random parameters like the nonce.a 256-bit key suitable for ChaCha20 key, SecureRandom a random)SecureRandom implementation used to create the
random nonce. If null is used for the random object,
then an internal secure random source will be used to create the
nonce.Implements abstract javax. Initialize the engine using a key and secure random implementation. |
| protected void | engineInit(int
the type of operation to do. This value must be either
opmode, Key Cipher.ENCRYPT_MODE or Cipher.DECRYPT_MODEa 256-bit key suitable for ChaCha20 key, AlgorithmParameterSpec a params, SecureRandom ChaCha20ParameterSpec that will provide
the nonce and initial block counter value.a random)SecureRandom implementation, this parameter
is not used in this form of the initializer.Implements abstract javax. Initialize the engine using a key and secure random implementation. |
| protected void | engineInit(int
the type of operation to do. This value must be either
opmode, Key Cipher.ENCRYPT_MODE or Cipher.DECRYPT_MODEa 256-bit key suitable for ChaCha20 key, AlgorithmParameters a params, SecureRandom null value if the algorithm is ChaCha20, or
the appropriate AlgorithmParameters object containing the
nonce information if the algorithm is ChaCha20-Poly1305.a random)SecureRandom implementation, may be null.Implements abstract javax. Initialize the engine using the |
| protected void | engineSetMode(String
The mode value mode)Implements abstract javax. Set the mode of operation. |
| protected void | engineSetPadding(String
The padding type. The only allowed value is
padding)NoPadding case insensitive.Implements abstract javax. Set the padding scheme. |
| protected Key | Returns: the unwrapped key as aKey object.the key to unwrap. wrappedKey, String the algorithm associated with the wrapped key algorithm, int the type of the wrapped key. This is one of
type)SECRET_KEY, PRIVATE_KEY, or PUBLIC_KEY.Overrides javax. Unwrap a |
| protected byte[] | Returns: the resulting plaintext or ciphertext bytes (depending on the operation type)the plaintext or ciphertext input bytes (depending on the
operation type). in, int the offset into the input array inOfs, int the length of the data to use for the update operation. inLen)Implements abstract javax. Update the currently running operation with additional data |
| protected int | Returns: the length in bytes of the data written into theout
buffer.the plaintext or ciphertext input bytes (depending on the
operation type). in, int the offset into the input array inOfs, int the length of the data to use for the update operation. inLen, byte[] the byte array that will hold the resulting data. The array
must be large enough to hold the resulting data. out, int the offset for the outOfs)out buffer to begin writing
the resulting data.Implements abstract javax. Update the currently running operation with additional data |
| protected int | Returns: the length in bytes of the data written into theoutput
buffer.the plaintext or ciphertext ByteBuffer input, ByteBuffer ByteBuffer that will hold the resulting data. This
must be large enough to hold the resulting data. output)Overrides javax. Update the currently running operation with additional data |
| protected void | engineUpdateAAD(byte[]
the byte array containing the authentication data. src, int the starting offset in the buffer to update. offset, int the amount of authentication data to update. len)Overrides javax. Update additional authenticated data (AAD). |
| protected void | engineUpdateAAD(ByteBuffer
the ByteBuffer containing the authentication data. src)Overrides javax. Update additional authenticated data (AAD). |
| protected byte[] | Returns: a byte array consisting of the wrapped key.the key to wrap. The data that will be encrypted will
be the provided key)Key in its encoded form.Overrides javax. Wrap a |
| private static byte[] | Returns: the key bytesthe key)Key object used for this CipherReturn the encoded key as a byte array |
| private static int | Returns: the number of keystream bytes generated. In a pure Java method this will always be 64 bytes, but intrinsics that make use of AVX2 or AVX512 registers may generate multiple blocks of keystream in a single call and therefore may be a larger multiple of 64.the starting state using the current counter value. initState, byte[] the array that will hold the result of the ChaCha20
block function. result)Perform a full 20-round ChaCha20 transform on the initial state. |
| private void | |
| private void | |
| private void | |
| private void | |
| private static void |