TAesGcmTag = array[0..15] of Byte;
TGHashBlock = TAesBlock;
procedure Aes256GcmEncrypt(const Key: TAes256Key; const IV, Plain, AAD: TBytes;
out Cipher: TBytes; out Tag: TAesGcmTag);
function Aes256GcmDecrypt(const Key: TAes256Key; const IV, Cipher, AAD: TBytes;
const Tag: TAesGcmTag; out Plain: TBytes): Boolean;
procedure Aes128GcmEncrypt(const Key: TAes128Key; const IV, Plain, AAD: TBytes;
out Cipher: TBytes; out Tag: TAesGcmTag);
function Aes128GcmDecrypt(const Key: TAes128Key; const IV, Cipher, AAD: TBytes;
const Tag: TAesGcmTag; out Plain: TBytes): Boolean;
FPdfAesGcm implements AES in Galois/Counter Mode over the block primitives in FPdfAes. It produces ciphertext and a 16-byte authentication tag, and accepts additional authenticated data (AAD) that is covered by the tag but not encrypted
The decrypt functions return False when the tag does not verify, so callers can reject tampered ciphertext without raising. This mode is used by structures that require authenticated encryption beyond the PDF AES-256-CBC security handler
GHASH processes AAD and ciphertext in separate, independently padded 16-byte blocks, using temporary storage whose size is independent of the input length; the caller's input arrays and output allocation remain separate costs
Counter-mode offsets use the platform's native integer width, and partial final blocks read only the available input bytes
| Function | Description |
|---|---|
Aes256GcmEncrypt | Encrypts Plain with a 256-bit key, IV, and AAD, returning ciphertext and a 16-byte tag |
Aes256GcmDecrypt | Decrypts Cipher with a 256-bit key, IV, and AAD, verifying the tag; returns False on tag mismatch |
Aes128GcmEncrypt | Encrypts Plain with a 128-bit key, IV, and AAD, returning ciphertext and a 16-byte tag |
Aes128GcmDecrypt | Decrypts Cipher with a 128-bit key, IV, and AAD, verifying the tag; returns False on tag mismatch |
| Type | Description |
|---|---|
TAesGcmTag | 16-byte authentication tag produced and verified by GCM |
TGHashBlock | Alias for TAesBlock used by the GHASH building block |
out argument