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 Cipher
Cipher.Mode -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final intprotected Cipherprotected Keyprivate final intprivate static final intprivate static final Stringprotected Keyprivate byte[]protected Macprivate static final Stringprotected Cipher.Modeprivate static final byte[]private static final intFields inherited from class BaseCipher
cipher -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintprotected voidinitCipher(Cipher cipher, Cipher.Mode mode, byte[] key, byte[] iv) private byte[]longToBytes(long lng) 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 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:
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
- Specified by:
initCipherin classBaseCipher
-
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
-
longToBytes
private byte[] longToBytes(long lng)
-