Package com.itextpdf.kernel.crypto
Class AESGCMCipher
- java.lang.Object
-
- com.itextpdf.kernel.crypto.AESGCMCipher
-
public class AESGCMCipher extends java.lang.Object
Creates an Advanced Encryption Standard-Galois/Counter Mode (AES-GCM) Cipher.
-
-
Field Summary
Fields Modifier and Type Field Description private static IBouncyCastleFactory
BOUNCY_CASTLE_FACTORY
private IGCMBlockCipher
cipher
static int
MAC_SIZE_BITS
-
Constructor Summary
Constructors Constructor Description AESGCMCipher(boolean forEncryption, byte[] key, byte[] iv)
Creates a new instance ofAESGCMCipher
.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description byte[]
doFinal()
Finishes a multiple-part encryption or decryption operation, depending on how this cipher was initialized and resets underlying cipher object to the state it was in when previously initialized via a call to init.byte[]
update(byte[] b, int off, int len)
Continues a multiple-part encryption or decryption operation (depending on how this cipher was initialized), processing another data part.
-
-
-
Field Detail
-
MAC_SIZE_BITS
public static final int MAC_SIZE_BITS
- See Also:
- Constant Field Values
-
BOUNCY_CASTLE_FACTORY
private static final IBouncyCastleFactory BOUNCY_CASTLE_FACTORY
-
cipher
private final IGCMBlockCipher cipher
-
-
Constructor Detail
-
AESGCMCipher
public AESGCMCipher(boolean forEncryption, byte[] key, byte[] iv)
Creates a new instance ofAESGCMCipher
.- Parameters:
forEncryption
- if true the cipher is initialised for encryption, if false for decryptionkey
- the key to be used in the cipheriv
- initialization vector to be used in cipher
-
-
Method Detail
-
update
public byte[] update(byte[] b, int off, int len)
Continues a multiple-part encryption or decryption operation (depending on how this cipher was initialized), processing another data part.The first
len
bytes in theb
input buffer, starting atoff
offset inclusive, are processed, and the result is stored in a new buffer.- Parameters:
b
- the input bufferoff
- the offset inb
where the input startslen
- the input length- Returns:
- the new buffer with the result
-
doFinal
public byte[] doFinal()
Finishes a multiple-part encryption or decryption operation, depending on how this cipher was initialized and resets underlying cipher object to the state it was in when previously initialized via a call to init.- Returns:
- final bytes array
-
-