PDFium Delphi Component 文件

FPdfMac 單元

單元: FPdfMac
為獨立與附加簽章形式的 ISO/TS 32004 PDF 認證碼,建構並驗證 CMS AuthenticatedData 權杖

Syntax

function BuildStandalonePdfMacToken(const FileEncryptionKey, KdfSalt,
  DataDigest: TBytes): TBytes;
function VerifyStandalonePdfMacToken(const Token, FileEncryptionKey,
  KdfSalt, ExpectedDataDigest: TBytes;
  out ErrorText: string): Boolean;
function BuildAttachedPdfMacToken(const FileEncryptionKey, KdfSalt,
  DataDigest, SignatureDigest: TBytes; SignatureObjectNumber,
  SignatureGeneration: Integer): TBytes;
function VerifyAttachedPdfMacToken(const Token, FileEncryptionKey, KdfSalt,
  ExpectedDataDigest, ExpectedSignatureDigest: TBytes;
  SignatureObjectNumber, SignatureGeneration: Integer;
  out ErrorText: string): Boolean;

Description

建構器以 HKDF-SHA256 與 UTF-8 info 值 PDFMAC,從 32 位元組檔案加密金鑰與 /KDFSalt 衍生 AES-256 金鑰加密金鑰

隨機產生的 256 位元 MAC 金鑰以 RFC 3394 AES-256 Key Wrap 包裝,並放入 ISO/TS 32004 要求的單一 PasswordRecipientInfo

權杖內嵌版本零的 PdfMacIntegrityInfo、必要的已認證屬性、CMSAlgorithmProtection,以及對屬性之標準 DER SET 編碼的 HMAC-SHA256 值

PDF 序列化由呼叫端負責,並提供精確 /ByteRange 區段的 SHA-256 摘要;應用程式通常使用 TPdfEncryptOptions.EnableIntegrityProtection 與 TPdf.ValidatePdfMac

附加權杖會將資料摘要綁定到簽章摘要與簽章物件編號及世代,再建構或驗證相同的已認證權杖格式

Functions

FunctionDescription
BuildStandalonePdfMacToken從 32 位元組的檔案加密金鑰、KDF salt 與資料摘要值建構獨立 AuthenticatedData 權杖
VerifyStandalonePdfMacToken驗證標準 DER、演算法、屬性、包裝金鑰、預期資料摘要與 HMAC,並在比較機密值時以常數時間進行
BuildAttachedPdfMacToken將資料摘要、簽章摘要、簽章物件編號與簽章世代雜湊到綁定的完整性摘要,建構附加權杖
VerifyAttachedPdfMacToken從預期的簽章內容重建附加綁定摘要,並驗證產生的權杖

Current scope

實作支援獨立與附加簽章認證碼、SHA-256 資料與簽章摘要、HMAC-SHA256、AES-256 Key Wrap,以及 32 位元組 Standard Security Handler 檔案金鑰

不產生公開金鑰安全處理器與其他摘要演算法

See Also

FPdfHmac, FPdfAes, FPdfEncrypt, TPdf.ValidatePdfMac