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 以 FPdfAes 的區塊基本操作實作 Galois/Counter 模式的 AES。它產生密文與 16 位元組認證標籤,並接受額外認證資料(AAD):AAD 受標籤保護但不加密
解密函式在標籤驗證失敗時傳回 False,呼叫端無需拋出例外即可拒絕遭竄改的密文。此模式供 PDF AES-256-CBC 安全處理器之外需要認證加密的結構使用
| Function | Description |
|---|---|
Aes256GcmEncrypt | 以 256 位元金鑰、IV 與 AAD 加密 Plain,傳回密文與 16 位元組標籤 |
Aes256GcmDecrypt | 以 256 位元金鑰、IV 與 AAD 解密 Cipher 並驗證標籤;標籤不符時傳回 False |
Aes128GcmEncrypt | 以 128 位元金鑰、IV 與 AAD 加密 Plain,傳回密文與 16 位元組標籤 |
Aes128GcmDecrypt | 以 128 位元金鑰、IV 與 AAD 解密 Cipher 並驗證標籤;標籤不符時傳回 False |
| Type | Description |
|---|---|
TAesGcmTag | GCM 產生並驗證的 16 位元組認證標籤 |
TGHashBlock | GHASH 基本元件使用的 TAesBlock 別名 |