How do I
use digital certificates in the Software Developer Kits (SDKs)?
How do I use digital signatures in the PDF-XChange and PDF-Tools SDKs?
The information below is a general guide that details how to use the MS Windows“CryptoAPI” & Digital Certificates in conjunction with the PDF XChange tools. We advise that developers have some knowledge of cryptology in order to understand the processes involved. Microsoft’s MSDN site provides comprehensive information regarding cryptography. See here for further information.
The PDF-XChange library exposes the essential functionality in the following library functions:
PXCp_SignDocumentBufW, which uses a memory buffer that contains a certificate in the PKCS#7 format.
PXCp_SignDocumentUsingPFXW, which uses a PFX file that contains a certificate in the PKCS#7 format.
The easiest way to create and manage certificates is to use the MS utilities MakeCert.exe and CertMgr.exe. If Microsoft Visual Studio is installed on the local computer then these utilities should already be available. Alternatively, they can be downloaded at the following links:
The following command example creates a self-signed certificate in ‘my’ store. The name of the created certificate is CertificateName. The ‘pe’ parameter specifies that the private key associated with the certificate can be exported:
makecert.exe –r –pe –ss my –n cn=”CertificateName”
The examples below detail the manner in which exported certificates located in ‘my’ save to disk. If a /7 key presents then the resultant *.pfx file contains the certificate in PKCS#7 format:
Certmgr.exe /put /c /7 /s my c:\mycert.pfx
Certmgr.exe /put /c /s my c:\mycert.cer
The PXCp_SignDocumentUsingPFXW function can be used in conjunction with files such as these to sign the content of PDF pages.