PDFium Delphi Component 文件

FPdfAesGcm 單元

單元: FPdfAesGcm
AES-128 與 AES-256 金鑰的純 Pascal AES-GCM 認證加密,產生密文與 16 位元組認證標籤

Syntax

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;

Description

FPdfAesGcm 以 FPdfAes 的區塊基本操作實作 Galois/Counter 模式的 AES。它產生密文與 16 位元組認證標籤,並接受額外認證資料(AAD):AAD 受標籤保護但不加密

解密函式在標籤驗證失敗時傳回 False,呼叫端無需拋出例外即可拒絕遭竄改的密文。此模式供 PDF AES-256-CBC 安全處理器之外需要認證加密的結構使用

Functions

FunctionDescription
Aes256GcmEncrypt以 256 位元金鑰、IV 與 AAD 加密 Plain,傳回密文與 16 位元組標籤
Aes256GcmDecrypt以 256 位元金鑰、IV 與 AAD 解密 Cipher 並驗證標籤;標籤不符時傳回 False
Aes128GcmEncrypt以 128 位元金鑰、IV 與 AAD 加密 Plain,傳回密文與 16 位元組標籤
Aes128GcmDecrypt以 128 位元金鑰、IV 與 AAD 解密 Cipher 並驗證標籤;標籤不符時傳回 False

Types

TypeDescription
TAesGcmTagGCM 產生並驗證的 16 位元組認證標籤
TGHashBlockGHASH 基本元件使用的 TAesBlock 別名

Remarks

See Also

FPdfAes