THotPDF.SignPDFWithSystemCertificate Method
企业版:此功能随 HotPDF Enterprise 提供。在 uses 子句中加入 HPDFEnterprise(C++Builder:#pragma link "HPDFEnterprise");其他版本保留声明,调用时抛出 EHPDFEnterpriseRequired
方法摘要: THotPDF.SignPDFWithSystemCertificate Method
声明
class function SignPDFWithSystemCertificate(const InputPDFPath,
OutputPDFPath: string; const Selector: THPDFCertificateStoreSelector;
const Options: THPDFCMSSignOptions): boolean; overload; static;
class function SignPDFWithSystemCertificate(const InputPDFPath,
OutputPDFPath: string; const Selector: THPDFCertificateStoreSelector;
const Options: THPDFCMSSignOptions;
CancellationToken: THPDFCancellationToken): boolean; overload; static;
class function SignPDFWithSystemCertificate(InputStream, OutputStream: TStream;
const Selector: THPDFCertificateStoreSelector;
const Options: THPDFCMSSignOptions): boolean; overload; static;
class function SignPDFWithSystemCertificate(InputStream, OutputStream: TStream;
const Selector: THPDFCertificateStoreSelector;
const Options: THPDFCMSSignOptions;
CancellationToken: THPDFCancellationToken): boolean; overload; static;
单元
HPDFDoc
参数
| 名称 | 用途 |
|---|---|
InputPDFPath | 源 PDF 文件路径 |
OutputPDFPath | 已签名 PDF 的目标路径 |
Selector | 用于选择签名证书的证书存储选择器 |
Options | CMS 签名选项,控制摘要、签名元数据、时间戳及相关策略 |
InputStream | 定位在 PDF 起始位置的源流 |
OutputStream | 接收已签名 PDF 的目标流 |
CancellationToken | 可选的协作式取消令牌,接受它的文件与流重载都会遵守该令牌 |
返回值
找到证书且已签名 PDF 写入成功时返回 True
使用说明
- 输入和输出的文件路径或流必须不同
- 当前进程必须能够访问 Windows 证书的私钥
- 该辅助方法要求 Delphi 2009 或更高版本
Options.DigestAlgorithm - CNG ECDSA 签名会从 Windows 原始坐标格式转换为 CMS 要求的 DER 形式
- Windows 版本和密钥存储提供程序必须实现所选的 SHA-3 算法
- 旧版 CryptoAPI 密钥支持 RSA PKCS#1 v1.5 搭配 SHA-256、SHA-384 或 SHA-512,并显式拒绝 SHA-3、RSA-PSS 和 ECDSA
- 该辅助方法需要 Delphi 2009 或更高版本