Class ChachaPolyCipher

  • All Implemented Interfaces:
    Cipher

    public class ChachaPolyCipher
    extends BaseCipher
    • Nested Class Summary

      • Nested classes/interfaces inherited from interface net.schmizz.sshj.transport.cipher.Cipher

        Cipher.Mode
    • Field Summary

      Fields 
      Modifier and Type Field Description
      protected javax.crypto.Cipher aadCipher  
      protected java.security.Key aadCipherKey  
      protected java.security.Key cipherKey  
      protected javax.crypto.Mac mac  
      protected Cipher.Mode mode  
    • Constructor Summary

      Constructors 
      Constructor Description
      ChachaPolyCipher​(int authSize, int bsize, java.lang.String algorithm)  
    • Method Summary

      Modifier and Type Method Description
      int getAuthenticationTagSize()  
      protected void initCipher​(javax.crypto.Cipher cipher, Cipher.Mode mode, byte[] key, byte[] iv)  
      void setSequenceNumber​(long seq)  
      void update​(byte[] input, int inputOffset, int inputLen)
      Performs in-place encryption or decryption on the given data.
      void updateAAD​(byte[] data)
      Adds the provided input data as additional authenticated data during encryption or decryption.
      void updateAAD​(byte[] data, int offset, int length)
      Adds the provided input data as additional authenticated data during encryption or decryption.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • aadCipher

        protected javax.crypto.Cipher aadCipher
      • mac

        protected javax.crypto.Mac mac
      • cipherKey

        protected java.security.Key cipherKey
      • aadCipherKey

        protected java.security.Key aadCipherKey
    • Constructor Detail

      • ChachaPolyCipher

        public ChachaPolyCipher​(int authSize,
                                int bsize,
                                java.lang.String algorithm)
    • Method Detail

      • initCipher

        protected void initCipher​(javax.crypto.Cipher cipher,
                                  Cipher.Mode mode,
                                  byte[] key,
                                  byte[] iv)
                           throws java.security.InvalidKeyException,
                                  java.security.InvalidAlgorithmParameterException
        Specified by:
        initCipher in class BaseCipher
        Throws:
        java.security.InvalidKeyException
        java.security.InvalidAlgorithmParameterException
      • updateAAD

        public void updateAAD​(byte[] data,
                              int offset,
                              int length)
        Description copied from interface: Cipher
        Adds the provided input data as additional authenticated data during encryption or decryption.
        Specified by:
        updateAAD in interface Cipher
        Overrides:
        updateAAD in class BaseCipher
        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
      • updateAAD

        public void updateAAD​(byte[] data)
        Description copied from interface: Cipher
        Adds the provided input data as additional authenticated data during encryption or decryption.
        Specified by:
        updateAAD in interface Cipher
        Overrides:
        updateAAD in class BaseCipher
        Parameters:
        data - The data to authenticate
      • update

        public void update​(byte[] input,
                           int inputOffset,
                           int inputLen)
        Description copied from interface: Cipher
        Performs in-place encryption or decryption on the given data.
        Specified by:
        update in interface Cipher
        Overrides:
        update in class BaseCipher
        Parameters:
        input - the subject
        inputOffset - offset at which to start
        inputLen - number of bytes starting at inputOffset