Class ChachaPolyCipher
java.lang.Object
net.schmizz.sshj.transport.cipher.BaseCipher
com.hierynomus.sshj.transport.cipher.ChachaPolyCipher
- All Implemented Interfaces:
Cipher
-
Nested Class Summary
Nested classes/interfaces inherited from interface net.schmizz.sshj.transport.cipher.Cipher
Cipher.Mode
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final int
protected Cipher
protected Key
private final int
private static final int
private static final String
protected Key
private byte[]
protected Mac
private static final String
protected Cipher.Mode
private static final byte[]
private static final int
Fields inherited from class net.schmizz.sshj.transport.cipher.BaseCipher
cipher
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
protected void
initCipher
(Cipher cipher, Cipher.Mode mode, byte[] key, byte[] iv) private byte[]
longToBytes
(long lng) 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 net.schmizz.sshj.transport.cipher.BaseCipher
getBlockSize, getIVSize, getKeySpec, getMode, init, updateWithAAD
-
Field Details
-
CHACHA_KEY_SIZE
private static final int CHACHA_KEY_SIZE- See Also:
-
AAD_LENGTH
private static final int AAD_LENGTH- See Also:
-
POLY_TAG_LENGTH
private static final int POLY_TAG_LENGTH- See Also:
-
CIPHER_CHACHA
- See Also:
-
MAC_POLY1305
- See Also:
-
POLY_KEY_INPUT
private static final byte[] POLY_KEY_INPUT -
authSize
private final int authSize -
encryptedAad
private byte[] encryptedAad -
mode
-
aadCipher
-
mac
-
cipherKey
-
aadCipherKey
-
-
Constructor Details
-
ChachaPolyCipher
-
-
Method Details
-
getAuthenticationTagSize
public int getAuthenticationTagSize()- Specified by:
getAuthenticationTagSize
in interfaceCipher
- Overrides:
getAuthenticationTagSize
in 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:
setSequenceNumber
in interfaceCipher
- Overrides:
setSequenceNumber
in classBaseCipher
-
initCipher
- Specified by:
initCipher
in classBaseCipher
-
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 interfaceCipher
- Overrides:
updateAAD
in 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:Cipher
Adds the provided input data as additional authenticated data during encryption or decryption.- Specified by:
updateAAD
in interfaceCipher
- Overrides:
updateAAD
in classBaseCipher
- 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 interfaceCipher
- Overrides:
update
in classBaseCipher
- Parameters:
input
- the subjectinputOffset
- offset at which to startinputLen
- number of bytes starting atinputOffset
-
longToBytes
private byte[] longToBytes(long lng)
-