|
THotPDF.SignPDFWithPFX
|
הקודם מתודות AddPubKeyRecipient |
|
Signs an existing PDF placeholder using a PFX / PKCS#12 file, building a CMS SignedData container and writing the signed PDF in one call.
Delphi syntax (file overload): class function SignPDFWithPFX( const InputPDFPath: string; const OutputPDFPath: string; const PFXFilePath: string; const Password: AnsiString): boolean; overload; static;
Delphi syntax (stream overload): class function SignPDFWithPFX( InputStream: TStream; OutputStream: TStream; const PFXFilePath: string; const Password: AnsiString): boolean; overload; static;
תיאור
1. טוענת את PDF הקלט, מאתרת placeholders sentinel של 2. טוענת את קובץ PFX ומפענחת אותו באמצעות הסיסמה שסופקה. נתמך PBES2 עם PBKDF2-HMAC-SHA-256 + AES-256-CBC, שהוא ברירת המחדל לקובצי PFX שמיוצאים על ידי OpenSSL 3.0+, Windows 11+ certutil ו-macOS Keychain Access. קובצי PBE-SHA1-3DES legacy מעלים diagnostic; יצא מחדש עם 3. מחשבת SHA-256 על bytes המסמך המכוסים על ידי 4. מקודדת את CMS DER ל-hex, מוודאת שהוא נכנס ל-budget של 5. Writes the patched bytes to the output path or stream.
Returns True on success. Raises
Typical workflow
Doc := THotPDF.Create(nil); Doc.FileName := 'unsigned.pdf'; Doc.BeginDoc; Doc.CurrentPage.AddSignedSignatureField( 'Sig1', Rect(60, 60, 260, 90), 8192, 'adbe.pkcs7.detached', 'Approved', 'Brussels', '', []); Doc.EndDoc; Doc.Free; THotPDF.SignPDFWithPFX('unsigned.pdf', 'signed.pdf', 'mykey.pfx', 'mypassword');
Notes אלגוריתם החתימה הוא RSA + SHA-256 (
עבור תהליכי PAdES B-T / B-LT / B-LTA שצריכים RFC 3161 timestamps, מילוני DSS או חתימות document timestamp, עזרי producer-side כגון
See also: AddSignedSignatureField, PreparePDFForSigning, InsertSignatureHex, AddPAdESSignatureField |