Do you own a Debenu Quick PDF Library version 7, 8, 9, 10, 11, 12, 13 or iSEDQuickPDF license? Upgrade to Debenu Quick PDF Library 14 today!

Debenu Quick PDF Library - PDF SDK Community Forum Homepage
Forum Home Forum Home > For Users of the Library > Sample Code
  New Posts New Posts RSS Feed - Digital Signature
  FAQ FAQ  Forum Search   Register Register  Login Login

Digital Signature

 Post Reply Post Reply
Author
Message
DigitalSignature View Drop Down
Beginner
Beginner


Joined: 20 Jan 21
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote DigitalSignature Quote  Post ReplyReply Direct Link To This Post Topic: Digital Signature
    Posted: 20 Jan 21 at 8:40AM
Hi, my application is in C/C++ for Windows platform & I want to use Quick PDF library to generate multi-lingual PDFs that are digitally signed using one of the certificates on system.

I'm unable to get any documentation on how would one use Quick PDF library to digitally sign a PDF using a certificate from store. All I've got until now is SetSignProcessCertFromStore method from the documents, but there is no sample code on how do I go about using it.

Any documentation or samples or guide on this would be really helpful.
Back to Top
tfrost View Drop Down
Senior Member
Senior Member


Joined: 06 Sep 10
Location: UK
Status: Offline
Points: 437
Post Options Post Options   Thanks (1) Thanks(1)   Quote tfrost Quote  Post ReplyReply Direct Link To This Post Posted: 20 Jan 21 at 1:34PM
I have not used a certificate from the Windows store, but I have used a certificate from a PFX file.

Basically you start a Sign Process with qp.NewSignProcessFromX, where X is 'file' or 'stream' or 'string' containing the PDF. This function returns a sign process ID which is required in all subsequent signing calls.

Then if you want a picture stamp, you may need to use SetSignProcessField, SetSignProcessFieldBounds, SetSignProcessFieldImageFromFile, and then you may need QP.SetNeedAppearances(0). 

Next, SetSignProcessSubFilter and SetSignProcessInfo if you need them.

Finally I use SetSignProcessPFXFromFile to load the certificate, but you would replace this with SetSignProcessCertFromStore. To save the signed PDF you call EndSignProcessToFile(id, outputpdffile) and qp.GetSignProcessResult. 

Make sure that you use a certificate which supports PDF-signing. Not all do. And it is essential to check, report and fix any error returns from the above functions, before continuing to the next one.

It does all work, but there is a lot to get right.  Persevere!
Back to Top
DigitalSignature View Drop Down
Beginner
Beginner


Joined: 20 Jan 21
Status: Offline
Points: 12
Post Options Post Options   Thanks (0) Thanks(0)   Quote DigitalSignature Quote  Post ReplyReply Direct Link To This Post Posted: 21 Jan 21 at 4:21AM
@tfrost That was really helpful, thank you. Will try this out and get back if I run into any issue.
Back to Top
DigitalSignature View Drop Down
Beginner
Beginner


Joined: 20 Jan 21
Status: Offline
Points: 12
Post Options Post Options   Thanks (1) Thanks(1)   Quote DigitalSignature Quote  Post ReplyReply Direct Link To This Post Posted: 28 Jan 21 at 1:21PM
@tfrost It worked! Thanks a lot.

For others who would have a similar requirement to sign PDF using windows store certificate the process is as follows :

1) Start a signing intent with NewSignProcessFromXXX & use SignProcessID returned by this method on all API calls below
2) Get SHA1 hash of the certificate and call SetSignProcessCertFromStore
3) Specify signature field on PDF using SetSignProcessField, if you don't have one, it'll create it for you
4) Call EndSignProcessToXXX to sign PDF
5) GetSignProcessResult can be used to verify if PDF was signed successfully
Back to Top
mLipok View Drop Down
Senior Member
Senior Member
Avatar

Joined: 23 Apr 14
Location: Poland, Zabrze
Status: Offline
Points: 449
Post Options Post Options   Thanks (0) Thanks(0)   Quote mLipok Quote  Post ReplyReply Direct Link To This Post Posted: 23 Feb 21 at 11:36PM
maybe here:
https://developers.foxitsoftware.com/kb/article/advanced-options-signing-pdf-files/

btw.
Somebody can provide how to modify this example to use CryptCards ?

Here you can find description how to test my examples:
http://www.quickpdf.org/forum/forum_posts.asp?TID=2932&PID=12600&title=drawcapturedpagematrix-matrix-howto#12600
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 11.01
Copyright ©2001-2014 Web Wiz Ltd.

Copyright © 2017 Debenu. Debenu Quick PDF Library is a PDF SDK. All rights reserved. AboutContactBlogSupportOnline Store