SetSignProcessCertFromStoreByHandle

Security and signatures

Description

Selects the signing certificate for a sign process by a raw PCCERT_CONTEXT handle obtained externally - typically from EnumCertificates followed by CertDuplicateCertificateContext. This bypasses the by-Subject-CN lookup that SetSignProcessCertFromStore performs, letting callers pick a certificate by any criterion (qualified filter, validity window, fingerprint).

The handle must outlive the sign process (the caller owns it and must free it with CertFreeCertificateContext after EndSignProcess completes).

Syntax

Delphi

Function TPDFlib.SetSignProcessCertFromStoreByHandle(SignProcessID: Integer; CertHandle: Pointer): Integer;

Parameters

SignProcessIDThe sign process ID from NewSignProcessFromFile/Stream/String
CertHandleA PCCERT_CONTEXT (as Pointer) obtained from EnumCertificates.CertHandle and duplicated via CertDuplicateCertificateContext

Return values

0The sign process was not found or the handle was nil
1The certificate handle was bound to the sign process