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 class
Algorithm 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 int
protected boolean
protected Cipher.Mode
protected GcmCipher.CounterGCMParameterSpec
protected SecretKey
Fields inherited from class net.schmizz.sshj.transport.cipher.BaseCipher
cipher
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionint
protected Cipher
protected void
initCipher
(Cipher cipher, Cipher.Mode mode, byte[] key, byte[] iv) void
update
(byte[] input, int inputOffset, int inputLen) Performs in-place encryption or decryption on the given data.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, 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:
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
-
getInitializedCipherInstance
- Throws:
GeneralSecurityException
-
initCipher
protected void initCipher(Cipher cipher, Cipher.Mode mode, byte[] key, byte[] iv) throws InvalidKeyException, InvalidAlgorithmParameterException - Specified by:
initCipher
in classBaseCipher
- Throws:
InvalidKeyException
InvalidAlgorithmParameterException
-
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
-
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
-