Package org.apache.sshd.common.cipher
Class ChaCha20Cipher
java.lang.Object
org.apache.sshd.common.cipher.ChaCha20Cipher
- All Implemented Interfaces:
AlgorithmNameProvider,Cipher,CipherInformation,KeySizeIndicator
AEAD cipher based on the
OpenSSH
ChaCha20-Poly1305 cipher extension.
-
Nested Class Summary
Nested ClassesNested classes/interfaces inherited from interface org.apache.sshd.common.cipher.Cipher
Cipher.Mode -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected final ChaCha20Cipher.ChaChaEngineprotected final ChaCha20Cipher.ChaChaEngineprotected final Macprotected Cipher.Mode -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintintintintintvoidinit(Cipher.Mode mode, byte[] key, byte[] iv) Initialize the cipher for encryption or decryption with the given key and initialization vectorvoidupdate(byte[] input, int inputOffset, int inputLen) Performs in-place encryption or decryption on the given data.voidupdateAAD(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, waitMethods inherited from interface org.apache.sshd.common.cipher.Cipher
update, updateAAD, updateWithAAD
-
Field Details
-
headerEngine
-
bodyEngine
-
mac
-
mode
-
-
Constructor Details
-
ChaCha20Cipher
public ChaCha20Cipher()
-
-
Method Details
-
getAlgorithm
- Specified by:
getAlgorithmin interfaceAlgorithmNameProvider
-
init
Description copied from interface:CipherInitialize the cipher for encryption or decryption with the given key and initialization vector -
updateAAD
Description copied from interface:CipherAdds the provided input data as additional authenticated data during encryption or decryption. -
update
Description copied from interface:CipherPerforms in-place encryption or decryption on the given data. -
getTransformation
- Specified by:
getTransformationin interfaceCipherInformation- Returns:
- The actual transformation used - e.g., AES/CBC/NoPadding
-
getIVSize
public int getIVSize()- Specified by:
getIVSizein interfaceCipherInformation- Returns:
- Size of the initialization vector (in bytes)
-
getAuthenticationTagSize
public int getAuthenticationTagSize()- Specified by:
getAuthenticationTagSizein interfaceCipherInformation- Returns:
- Size of the authentication tag (AT) in bytes or 0 if this cipher does not support authentication
-
getCipherBlockSize
public int getCipherBlockSize()- Specified by:
getCipherBlockSizein interfaceCipherInformation- Returns:
- Size of block data used by the cipher (in bytes). For stream ciphers this value is (currently) used to indicate some average work buffer size to be used for the automatic re-keying mechanism described in RFC 4253 - Section 9
-
getKdfSize
public int getKdfSize()- Specified by:
getKdfSizein interfaceCipherInformation- Returns:
- The block size (in bytes) used to derive the secret key for this cipher
-
getKeySize
public int getKeySize()- Specified by:
getKeySizein interfaceKeySizeIndicator- Returns:
- The number of bits used in the key
-