Class GcmCipher
java.lang.Object
net.schmizz.sshj.transport.cipher.BaseCipher
com.hierynomus.sshj.transport.cipher.GcmCipher
- All Implemented Interfaces:
Cipher
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprotected static classAlgorithm parameters for AES/GCM that assumes the IV uses an 8-byte counter field as its most significant bytes.Nested classes/interfaces inherited from interface net.schmizz.sshj.transport.cipher.Cipher
Cipher.Mode -
Field Summary
FieldsModifier and TypeFieldDescriptionprotected intprotected booleanprotected Cipher.Modeprotected GcmCipher.CounterGCMParameterSpecprotected SecretKeyFields inherited from class net.schmizz.sshj.transport.cipher.BaseCipher
cipher -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionintprotected Cipherprotected voidinitCipher(Cipher cipher, Cipher.Mode mode, byte[] key, byte[] iv) voidupdate(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 net.schmizz.sshj.transport.cipher.BaseCipher
getBlockSize, getIVSize, getKeySpec, getMode, init, setSequenceNumber, updateAAD, updateWithAAD
-
Field Details
-
authSize
protected int authSize -
mode
-
initialized
protected boolean initialized -
parameters
-
secretKey
-
-
Constructor Details
-
GcmCipher
-
-
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
-
getInitializedCipherInstance
- Throws:
GeneralSecurityException
-
initCipher
protected void initCipher(Cipher cipher, Cipher.Mode mode, byte[] key, byte[] iv) throws InvalidKeyException, InvalidAlgorithmParameterException - Specified by:
initCipherin classBaseCipher- Throws:
InvalidKeyExceptionInvalidAlgorithmParameterException
-
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
-
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
-