Package org.apache.sshd.common.cipher
Class BaseGCMCipher
- java.lang.Object
-
- org.apache.sshd.common.cipher.BaseCipher
-
- org.apache.sshd.common.cipher.BaseGCMCipher
-
- All Implemented Interfaces:
AlgorithmNameProvider,Cipher,CipherInformation,KeySizeIndicator
public class BaseGCMCipher extends BaseCipher
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description protected static classBaseGCMCipher.CounterGCMParameterSpecAlgorithm parameters for AES/GCM that assumes the IV uses an 8-byte counter field as its least significant bytes.-
Nested classes/interfaces inherited from interface org.apache.sshd.common.cipher.Cipher
Cipher.Mode
-
-
Field Summary
Fields Modifier and Type Field Description protected booleaninitializedprotected Cipher.Modemodeprotected BaseGCMCipher.CounterGCMParameterSpecparametersprotected javax.crypto.SecretKeysecretKey
-
Constructor Summary
Constructors Constructor Description BaseGCMCipher(int ivsize, int authSize, int kdfSize, java.lang.String algorithm, int keySize, java.lang.String transformation, int blkSize)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description protected javax.crypto.CiphercreateCipherInstance(Cipher.Mode mode, byte[] key, byte[] iv)protected javax.crypto.CiphergetInitializedCipherInstance()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 org.apache.sshd.common.cipher.BaseCipher
getAlgorithm, getAuthenticationTagSize, getCipherBlockSize, getCipherInstance, getIVSize, getKdfSize, getKeySize, getTransformation, init, initializeIVData, initializeKeyData, resize, toString
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface org.apache.sshd.common.cipher.Cipher
update, updateAAD, updateWithAAD
-
-
-
-
Field Detail
-
mode
protected Cipher.Mode mode
-
initialized
protected boolean initialized
-
parameters
protected BaseGCMCipher.CounterGCMParameterSpec parameters
-
secretKey
protected javax.crypto.SecretKey secretKey
-
-
Method Detail
-
createCipherInstance
protected javax.crypto.Cipher createCipherInstance(Cipher.Mode mode, byte[] key, byte[] iv) throws java.lang.Exception
- Overrides:
createCipherInstancein classBaseCipher- Throws:
java.lang.Exception
-
getInitializedCipherInstance
protected javax.crypto.Cipher getInitializedCipherInstance() throws java.lang.Exception- Throws:
java.lang.Exception
-
updateAAD
public void updateAAD(byte[] data, int offset, int length) throws java.lang.ExceptionDescription 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- Throws:
java.lang.Exception- If failed to execute
-
update
public void update(byte[] input, int inputOffset, int inputLen) throws java.lang.ExceptionDescription copied from interface:CipherPerforms in-place encryption or decryption on the given data.- Specified by:
updatein interfaceCipher- Overrides:
updatein classBaseCipher- Parameters:
input- The input/output bytesinputOffset- The offset of the data in the data bufferinputLen- The number of bytes to update - starting at the given offset- Throws:
java.lang.Exception- If failed to execute
-
-