Class ChaCha20Cipher

java.lang.Object
org.apache.sshd.common.cipher.AbstractChaCha20Cipher
org.apache.sshd.common.cipher.ChaCha20Cipher
All Implemented Interfaces:
AlgorithmNameProvider, Cipher, CipherInformation, KeySizeIndicator

public class ChaCha20Cipher extends AbstractChaCha20Cipher
AEAD cipher based on the OpenSSH ChaCha20-Poly1305 cipher extension.
  • Field Details

  • Constructor Details

    • ChaCha20Cipher

      public ChaCha20Cipher()
  • Method Details

    • init

      public void init(Cipher.Mode mode, byte[] key, byte[] iv) throws Exception
      Description copied from interface: Cipher
      Initialize the cipher for encryption or decryption with the given key and initialization vector
      Parameters:
      mode - Encrypt/Decrypt initialization
      key - Key bytes
      iv - Initialization vector bytes
      Throws:
      Exception - If failed to initialize
    • updateAAD

      public void updateAAD(byte[] data, int offset, int length) throws Exception
      Description copied from interface: Cipher
      Adds the provided input data as additional authenticated data during encryption or decryption.
      Parameters:
      data - The additional data to authenticate
      offset - The offset of the additional data in the buffer
      length - The number of bytes in the buffer to use for authentication
      Throws:
      Exception - If failed to execute
    • update

      public void update(byte[] input, int inputOffset, int inputLen) throws Exception
      Description copied from interface: Cipher
      Performs in-place encryption or decryption on the given data.
      Parameters:
      input - The input/output bytes
      inputOffset - The offset of the data in the data buffer
      inputLen - The number of bytes to update, starting at the given offset; must be a multiple of the cipher's block size
      Throws:
      Exception - If failed to execute