Class ChachaPolyCipher
- java.lang.Object
-
- net.schmizz.sshj.transport.cipher.BaseCipher
-
- com.hierynomus.sshj.transport.cipher.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.CipheraadCipherprotected java.security.KeyaadCipherKeyprotected java.security.KeycipherKeyprotected javax.crypto.Macmacprotected Cipher.Modemode-
Fields inherited from class net.schmizz.sshj.transport.cipher.BaseCipher
cipher
-
-
Constructor Summary
Constructors Constructor Description ChachaPolyCipher(int authSize, int bsize, java.lang.String algorithm)
-
Method Summary
Modifier and Type Method Description intgetAuthenticationTagSize()protected voidinitCipher(javax.crypto.Cipher cipher, Cipher.Mode mode, byte[] key, byte[] iv)voidsetSequenceNumber(long seq)voidupdate(byte[] input, int inputOffset, int inputLen)Performs in-place encryption or decryption on the given data.voidupdateAAD(byte[] data)Adds the provided input data as additional authenticated data during encryption or decryption.voidupdateAAD(byte[] data, int offset, int length)Adds the provided input data as additional authenticated data during encryption or decryption.-
Methods inherited from class net.schmizz.sshj.transport.cipher.BaseCipher
getBlockSize, getIVSize, getKeySpec, getMode, init, updateWithAAD
-
-
-
-
Field Detail
-
mode
protected Cipher.Mode mode
-
aadCipher
protected javax.crypto.Cipher aadCipher
-
mac
protected javax.crypto.Mac mac
-
cipherKey
protected java.security.Key cipherKey
-
aadCipherKey
protected java.security.Key aadCipherKey
-
-
Method Detail
-
getAuthenticationTagSize
public int getAuthenticationTagSize()
- Specified by:
getAuthenticationTagSizein interfaceCipher- Overrides:
getAuthenticationTagSizein classBaseCipher- Returns:
- Size of the authentication tag (AT) in bytes or 0 if this cipher does not support authentication
-
setSequenceNumber
public void setSequenceNumber(long seq)
- Specified by:
setSequenceNumberin interfaceCipher- Overrides:
setSequenceNumberin classBaseCipher
-
initCipher
protected void initCipher(javax.crypto.Cipher cipher, Cipher.Mode mode, byte[] key, byte[] iv) throws java.security.InvalidKeyException, java.security.InvalidAlgorithmParameterException- Specified by:
initCipherin classBaseCipher- Throws:
java.security.InvalidKeyExceptionjava.security.InvalidAlgorithmParameterException
-
updateAAD
public void updateAAD(byte[] data, int offset, int length)Description copied from interface:CipherAdds the provided input data as additional authenticated data during encryption or decryption.- Specified by:
updateAADin interfaceCipher- Overrides:
updateAADin classBaseCipher- Parameters:
data- The additional data to authenticateoffset- The offset of the additional data in the bufferlength- The number of bytes in the buffer to use for authentication
-
updateAAD
public void updateAAD(byte[] data)
Description copied from interface:CipherAdds the provided input data as additional authenticated data during encryption or decryption.- Specified by:
updateAADin interfaceCipher- Overrides:
updateAADin classBaseCipher- Parameters:
data- The data to authenticate
-
update
public void update(byte[] input, int inputOffset, int inputLen)Description copied from interface:CipherPerforms in-place encryption or decryption on the given data.- Specified by:
updatein interfaceCipher- Overrides:
updatein classBaseCipher- Parameters:
input- the subjectinputOffset- offset at which to startinputLen- number of bytes starting atinputOffset
-
-