AddPublicKeyRecipientFromPFX
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 the certificate carrying a private-key association from a PKCS #12 PFX file as a public-key encryption recipient
Syntax
Delphi
Function TPDFlib.AddPublicKeyRecipientFromPFX(Const PFXFileName, PFXPassword: WideString; UseMachineKeyset, Permissions: Integer): Integer; Virtual;
ActiveX
Function PDFlib::AddPublicKeyRecipientFromPFX(PFXFileName As String, PFXPassword As String, UseMachineKeyset As Long, Permissions As Long) As Long
DLL
int DLAddPublicKeyRecipientFromPFX(int InstanceID, const wchar_t* PFXFileName, const wchar_t* PFXPassword, int UseMachineKeyset, int Permissions);
int DLAddPublicKeyRecipientFromPFXA(int InstanceID, const char* PFXFileName, const char* PFXPassword, int UseMachineKeyset, int Permissions);
Parameters
| PFXFileName | Path to the PKCS #12 PFX file |
|---|---|
| PFXPassword | Password protecting the PFX file |
| UseMachineKeyset | Use a nonzero value to import keys through the machine keyset or zero for the user keyset |
| Permissions | Permission mask returned by EncodePermissions |
Return values
| 1 | The recipient certificate was added |
|---|---|
| 0 | The PFX, password, permissions, or document state was invalid |
Remarks
The private key is used only to identify the leaf certificate while adding the recipient and is not embedded in the PDF
The DLL also exports DLAddPublicKeyRecipientFromPFXA for ANSI strings