THotPDF.SignPDFWithPFXAndAttachedPDFMAC Method
创建一个加密的已签名修订版本,其 PDF MAC 同时认证完整的签名 byte range 和原始 CMS 签名值
声明
class function SignPDFWithPFXAndAttachedPDFMAC(
const InputPDFPath, OutputPDFPath, PFXFilePath: string;
const PFXPassword, PDFPassword: AnsiString;
const MACOptions: THPDFPDFMACOptions): boolean; static;
Input requirements
- 输入文件必须使用受支持的 AES-256 密码安全处理程序加密
- The input must contain exactly one unsigned signature dictionary created with
AddSignedSignatureField - 签名字典及其签名域必须是直接的 xref 对象,这样固定宽度的占位符才能被原地回填
- PFX 文件必须包含受支持的 RSA 密钥材料,且提供的 PFX 密码必须能通过容器认证
Output guarantees
- The active trailer contains a direct
AuthCode与/MACLocation /AttachedToSigand one indirectSigObjRef - The CMS
SignerInfocontains oneid-attr-pdfMacDataunsigned attribute PdfMacIntegrityInfo.signatureDigest除文档摘要外,还携带原始签名值的摘要- SHA-256 签名和所选的 PDF MAC 摘要共用一次内存受限的文件扫描
- 只有完整的已签名输出全部成功后,才会替换目标路径
使用 ValidatePDFMAC 校验当前 trailer、SigObjRef、签名域绑定、完整的 byte range 覆盖、文档摘要、签名摘要以及 MAC 认证