THotPDF.SignPDFWithSystemCertificate Method
Signs a PDF file or stream with a certificate selected from the Windows certificate store and writes the signed result to a separate destination
Declaration
class function SignPDFWithSystemCertificate(const InputPDFPath, OutputPDFPath: string; const Selector: THPDFCertificateStoreSelector; const Options: THPDFCMSSignOptions): boolean; overload; static;
class function SignPDFWithSystemCertificate(InputStream, OutputStream: TStream; const Selector: THPDFCertificateStoreSelector; const Options: THPDFCMSSignOptions): boolean; overload; static;
Unit
HPDFDoc
Parameters
| Name | Purpose |
|---|---|
InputPDFPath | Source PDF file path |
OutputPDFPath | Destination path for the signed PDF |
Selector | Certificate-store selector used to choose the signing certificate |
Options | CMS signing options controlling the digest, signature metadata, timestamp, and related policy |
InputStream | Source stream positioned at the beginning of the PDF |
OutputStream | Destination stream that receives the signed PDF |
Return value
Returns True when the certificate is found and the signed PDF is written successfully
Usage notes
- The input and output file paths or streams must be different
- The Windows certificate private key must be accessible to the current process
- CNG-backed keys support RSA PKCS#1 v1.5, RSA-PSS, and ECDSA with the SHA-2 or SHA-3 digest selected by
Options.DigestAlgorithm - CNG ECDSA signatures are converted from the Windows raw coordinate format to the DER form required by CMS
- The Windows version and key-storage provider must implement the selected SHA-3 algorithm
- Legacy CryptoAPI keys support RSA PKCS#1 v1.5 with SHA-256, SHA-384, or SHA-512 and explicitly reject SHA-3, RSA-PSS, and ECDSA
- This helper requires Delphi 2009 or later