SetSignProcessCNGKey

Bezpečnosť a podpisy

Opis

Pripojí pomenovaný NCrypt súkromný kľúč a jeho certifikát X.509 v kódovaní DER k PDF podpisovému procesu

Kľúč sa otvorí priamo z požadovaného key storage providera, čo umožní podpisové identity založené na TPM, hardvérových tokenoch, cloud KSP a ďalšie len-CNG bez exportu súkromného kľúča

Syntax

Delphi

Function TPDFlib.SetSignProcessCNGKey(SignProcessID: Integer; Const CertificateDER: AnsiString; Const ProviderName, KeyName: WideString; UseMachineKey, AllowUI: Boolean): Integer;

ActiveX

Function PDFlib::SetSignProcessCNGKey(SignProcessID As Long, CertificateDER As Variant, ProviderName As String, KeyName As String, UseMachineKey As Long, AllowUI As Long) As Long

DLL

int DLSetSignProcessCNGKey(int InstanceID, int SignProcessID, const char* CertificateDER, int CertificateLength, const wchar_t* ProviderName, const wchar_t* KeyName, int UseMachineKey, int AllowUI);

Parametre

SignProcessIDValue returned by a NewSignProcessFrom* function
CertificateDERComplete DER-encoded RSA or ECDSA X.509 certificate corresponding to the private key
ProviderNameWindows key storage provider name, or an empty string for Microsoft Software Key Storage Provider
KeyNamePersistent key name understood by the provider
UseMachineKeyTrue or nonzero to open the key from machine scope
AllowUITrue or nonzero to permit PIN, consent, or cloud-approval user interfaces from the provider

Návratové hodnoty

1The identity configuration was attached to the process
0The process id, certificate, or key name was invalid

Poznámky

Kľúč sa otvorí, keď sa sign proces vykoná, a do pamäte knižnice nevstúpia žiadne bajty súkromného kľúča

When AllowUI is false, NCRYPT_SILENT_FLAG is applied to key opening and signingThe generated CMS signature is verified against

CertificateDER before it is accepted, so a same-algorithm but mismatched key is rejectedActiveX accepts a byte-array variant, and the DLL uses an explicit certificate length so embedded zero bytes are retained

Pozri tiež

SetSignProcessCNGKeyFromFile, SetSignProcessCNGKeyByHandle, SetSignProcessPrivateKeyUI