SetSignProcessCNGKeyFromFile
安全和签名
描述
从文件加载 DER 编码的 X.509 证书,并将命名的 NCrypt 私钥附加到 PDF 签名流程
语法
Delphi
Function TPDFlib.SetSignProcessCNGKeyFromFile(SignProcessID: Integer; Const CertificateFile, ProviderName, KeyName: WideString; UseMachineKey, AllowUI: Boolean): Integer;
ActiveX
Function PDFlib::SetSignProcessCNGKeyFromFile(SignProcessID As Long, CertificateFile As String, ProviderName As String, KeyName As String, UseMachineKey As Long, AllowUI As Long) As Long
DLL
int DLSetSignProcessCNGKeyFromFile(int InstanceID, int SignProcessID, const wchar_t* CertificateFile, const wchar_t* ProviderName, const wchar_t* KeyName, int UseMachineKey, int AllowUI);
参数
| CertificateFile | DER 编码的 RSA 或 ECDSA X.509 证书路径 |
|---|---|
| ProviderName | Windows 密钥存储提供程序名称;空字符串表示 Microsoft 软件提供程序 |
| KeyName | 提供程序可识别的持久密钥名称 |
| UseMachineKey | 为 True 或非零值时使用计算机密钥范围 |
| AllowUI | 为真或非零时允许提供程序交互 |
返回值
| 1 | 已读取证书并附加配置 |
|---|---|
| 0 | 文件、进程 ID 或密钥名称无效 |
备注
DLL 还会为 ANSI 路径和名称导出 DLSetSignProcessCNGKeyFromFileA
签名流程会保留证书字节,而私钥保留在其提供程序内部