SetSignProcessCNGKeyFromFile

Security and signatures

Description

Loads a DER-encoded X.509 certificate from a file and attaches a named NCrypt private key to a PDF signing process

Syntax

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);

Parameters

CertificateFilePath to a DER-encoded RSA or ECDSA X.509 certificate
ProviderNameWindows key storage provider name, or an empty string for the Microsoft software provider
KeyNamePersistent key name understood by the provider
UseMachineKeyTrue or nonzero to use machine key scope
AllowUITrue or nonzero to permit provider interaction

Return values

1The certificate was read and the configuration was attached
0The file, process id, or key name was invalid

Remarks

The DLL also exports DLSetSignProcessCNGKeyFromFileA for ANSI paths and names

The certificate bytes are retained by the sign process, while the private key remains inside its provider

See also

SetSignProcessCNGKey, SetSignProcessPFXFromFile