PDF MAC Algorithm Agility and Policy Profiles
HotPDF can produce and validate ISO/TS 32004 standalone and signature-attached PDF MAC values with six document-digest algorithms and fail-closed policy enforcement
Supported document digests
THPDFPDFMACDigestAlgorithm provides pmdaSHA256, pmdaSHA384, pmdaSHA512, pmdaSHA3_256, pmdaSHA3_384, and pmdaSHA3_512
The selected digest protects the complete PDF ByteRange, the encapsulated integrity information, the CMS digest algorithm, and the CMSAlgorithmProtection attribute
HMAC-SHA-256 authentication, HKDF-SHA-256 key derivation, and AES-256 key wrap remain fixed by the PDF MAC format and are not changed by the document-digest selection
Built-in profiles
Built-in profile requirements are fixed and cannot be weakened by changing record fields; use pmppCustom when an application needs a different generation algorithm, allowlist, or encryption requirement
| Factory | Generation | Validation | Encryption |
|---|---|---|---|
Compatibility | SHA-256 | All six supported digests | AES-256 or AES-256-GCM |
Modern | SHA-384 | SHA-384, SHA-512, SHA3-384, or SHA3-512 | AES-256 or AES-256-GCM |
HighAssurance | SHA3-512 | SHA3-512 only | AES-256-GCM required |
Custom | Caller selected | Caller allowlist | Caller selected |
Delphi example
uses HPDFDoc, HPDFPDFMAC;
var
Options: THPDFPDFMACOptions;
Info: THPDFPDFMACValidationInfo;
begin
Options := THPDFPDFMACOptions.HighAssurance;
if not PDF.AddStandalonePDFMAC('encrypted.pdf', 'authenticated.pdf',
'user-password', Options) then
raise Exception.Create('PDF MAC creation failed');
if not PDF.ValidatePDFMAC('authenticated.pdf', 'user-password',
Options, Info) then
raise Exception.Create(Info.Message);
end;
Validation decisions
Validation discovers the encoded digest before streaming the protected ranges, rejects algorithms outside AllowedDigestAlgorithms, and enforces RequireAESGCM after authenticated file-key recovery
THPDFPDFMACValidationInfo reports DigestAlgorithm, PolicyProfile, PolicyAccepted, and UsedAESGCM; pmsPolicyRejected is separate from malformed input or a failed authentication tag
For /AttachedToSig, the selected digest also protects the raw CMS signature value through PdfMacIntegrityInfo.signatureDigest, while ValidatePDFMAC verifies the active direct AuthCode, indirect SigObjRef, signature field binding, and complete signed revision
ValidatePDFMACChain applies the selected policy to every protected incremental revision, rejects digest-strength downgrade, requires a stable KDFSalt after the first MAC, and reports the exact failing revision and xref offset
See SignPDFWithPFXAndAttachedPDFMAC for the atomic PFX signing workflow