public class BaseGCMCipher extends BaseCipher
Modifier and Type | Class and Description |
---|---|
protected static class |
BaseGCMCipher.CounterGCMParameterSpec
Algorithm parameters for AES/GCM that assumes the IV uses an 8-byte counter field as its most significant bytes.
|
Cipher.Mode
Modifier and Type | Field and Description |
---|---|
protected boolean |
initialized |
protected Cipher.Mode |
mode |
protected BaseGCMCipher.CounterGCMParameterSpec |
parameters |
protected javax.crypto.SecretKey |
secretKey |
Constructor and Description |
---|
BaseGCMCipher(int ivsize,
int authSize,
int kdfSize,
java.lang.String algorithm,
int keySize,
java.lang.String transformation,
int blkSize) |
Modifier and Type | Method and Description |
---|---|
protected javax.crypto.Cipher |
createCipherInstance(Cipher.Mode mode,
byte[] key,
byte[] iv) |
protected javax.crypto.Cipher |
getInitializedCipherInstance() |
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.
|
getAlgorithm, getAuthenticationTagSize, getCipherBlockSize, getCipherInstance, getIVSize, getKdfSize, getKeySize, getTransformation, init, initializeIVData, initializeKeyData, resize, toString
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
checkSupported, update, updateAAD, updateWithAAD
protected Cipher.Mode mode
protected boolean initialized
protected BaseGCMCipher.CounterGCMParameterSpec parameters
protected javax.crypto.SecretKey secretKey
public BaseGCMCipher(int ivsize, int authSize, int kdfSize, java.lang.String algorithm, int keySize, java.lang.String transformation, int blkSize)
protected javax.crypto.Cipher createCipherInstance(Cipher.Mode mode, byte[] key, byte[] iv) throws java.lang.Exception
createCipherInstance
in class BaseCipher
java.lang.Exception
protected javax.crypto.Cipher getInitializedCipherInstance() throws java.lang.Exception
java.lang.Exception
public void updateAAD(byte[] data, int offset, int length) throws java.lang.Exception
Cipher
updateAAD
in interface Cipher
updateAAD
in class BaseCipher
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 authenticationjava.lang.Exception
- If failed to executepublic void update(byte[] input, int inputOffset, int inputLen) throws java.lang.Exception
Cipher
update
in interface Cipher
update
in class BaseCipher
input
- The input/output bytesinputOffset
- The offset of the data in the data bufferinputLen
- The number of bytes to update - starting at the given offsetjava.lang.Exception
- If failed to execute