Class ChaCha20Poly1305

java.lang.Object
com.sshtools.common.ssh.components.AbstractSshCipher
com.sshtools.common.ssh.components.jce.ChaCha20Poly1305
All Implemented Interfaces:
Component, SshCipher, SshComponent, SecureComponent

public class ChaCha20Poly1305 extends AbstractSshCipher
  • Constructor Details

  • Method Details

    • init

      public void init(int mode, byte[] iv, byte[] keydata) throws IOException
      Description copied from class: AbstractSshCipher
      Initialize the cipher with up to 40 bytes of iv and key data. Each implementation should take as much data from the initialization as it needs ignoring any data that it does not require.
      Specified by:
      init in interface SshCipher
      Specified by:
      init in class AbstractSshCipher
      Parameters:
      mode - the mode to operate
      iv - the initiaization vector
      keydata - the key data
      Throws:
      IOException
    • getBlockSize

      public int getBlockSize()
      Description copied from class: AbstractSshCipher
      Get the cipher block size.
      Specified by:
      getBlockSize in interface SshCipher
      Specified by:
      getBlockSize in class AbstractSshCipher
      Returns:
      the block size in bytes.
    • getKeyLength

      public int getKeyLength()
      Description copied from class: AbstractSshCipher
      Return the key length required
      Specified by:
      getKeyLength in interface SshCipher
      Specified by:
      getKeyLength in class AbstractSshCipher
      Returns:
    • getMacLength

      public int getMacLength()
      Specified by:
      getMacLength in interface SshCipher
      Overrides:
      getMacLength in class AbstractSshCipher
    • isMAC

      public boolean isMAC()
      Specified by:
      isMAC in interface SshCipher
      Overrides:
      isMAC in class AbstractSshCipher
    • transform

      public void transform(byte[] src, int start, byte[] dest, int offset, int len) throws IOException
      Description copied from class: AbstractSshCipher
      Transform the byte array according to the cipher mode; it is legal for the source and destination arrays to reference the same physical array so care should be taken in the transformation process to safeguard this rule.
      Specified by:
      transform in interface SshCipher
      Specified by:
      transform in class AbstractSshCipher
      Throws:
      IOException
    • getProviderName

      public String getProviderName()
      Specified by:
      getProviderName in interface SshCipher
      Specified by:
      getProviderName in class AbstractSshCipher
    • readPacketLength

      public long readPacketLength(byte[] encoded, com.sshtools.common.util.UnsignedInteger64 sequenceNo) throws IOException
      Throws:
      IOException
    • writePacketLength

      public byte[] writePacketLength(int length, com.sshtools.common.util.UnsignedInteger64 sequenceNo) throws IOException
      Throws:
      IOException
    • littleEndianToInt

      protected static int littleEndianToInt(byte[] bs, int i)
    • intToLittleEndian

      protected static void intToLittleEndian(int n, byte[] bs, int off)