AddPublicKeyRecipientFromStore
Security and signatures
Requires the Enterprise edition — in Delphi, C++Builder and Lazarus code create the library as TPDFlibEnterprise (unit PDFlibEnterprise); the Enterprise DLL and ActiveX builds provide it unchanged; other editions keep the method, which returns 0, an empty string or False and sets LastErrorCode to 900 (PDFLIB_ERROR_ENTERPRISE_REQUIRED)
Description
Adds an X.509 certificate from a Windows certificate store as a public-key encryption recipient
Syntax
Delphi
Function TPDFlib.AddPublicKeyRecipientFromStore(Const StoreName, CertificateName: WideString; UseMachineStore, Permissions: Integer): Integer; Virtual;
ActiveX
Function PDFlib::AddPublicKeyRecipientFromStore(StoreName As String, CertificateName As String, UseMachineStore As Long, Permissions As Long) As Long
DLL
int DLAddPublicKeyRecipientFromStore(int InstanceID, const wchar_t* StoreName, const wchar_t* CertificateName, int UseMachineStore, int Permissions);
int DLAddPublicKeyRecipientFromStoreA(int InstanceID, const char* StoreName, const char* CertificateName, int UseMachineStore, int Permissions);
Parameters
| StoreName | Windows certificate store name such as MY |
|---|---|
| CertificateName | Case-insensitive simple display name, or an empty string to select the first certificate |
| UseMachineStore | Use a nonzero value for the local-machine store or zero for the current-user store |
| Permissions | Permission mask returned by EncodePermissions |
Return values
| 1 | The recipient certificate was added |
|---|---|
| 0 | The store, certificate, permissions, or document state was invalid |
Remarks
The DLL also exports DLAddPublicKeyRecipientFromStoreA for ANSI strings