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 Mode의 AES를 구현합니다. 암호문과 16바이트 인증 태그를 생성하며, 태그로 보호되지만 암호화되지는 않는 추가 인증 데이터 (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의 별칭 |