Archived Forum Post
Digitally sign a PDF file using a PFX certificate?
Oct 04 '17 at 20:30
- Can I use Chilkat components to digitally sign a PDF file using a PFX certificate?
If so where can I find some examples?
It depends on what you mean by "sign a PDF file". There are three possibilities:
- The first is to create a PKCS7 opaque signature where the signature encapsulates the PDF file. In this case, the PDF file is no different than any other file. An example that calls Crypt2.CreateP7M using a PFX file is available here: https://www.example-code.com/delphiDll/cades_bes_attached_signature.asp (Verification involves extracting the original file.)
- The 2nd possibility is to create a PKCS7 detached signature that does not include the PDF file. To verify, you would need both the detached signature file and the original PDF file. To create a detached signature, you would call CreateP7S instead of CreateP7M (see https://www.example-code.com/delphiDll/cades_bes.asp)
- The 3rd possibility is to insert a digital signature (detached) into the PDF file itself. This modifies the PDF file, and PDF readers would see that it was signed and could verify it. This would require software that is capable of reading, modifying, and writing the PDF format. Chilkat does not (at this time) currently offer this functionality. This could change in the future.