We use cookies to give you the best experience on our website. If you continue to browse, then you agree to our privacy policy and cookie policy.
Unfortunately, activation email could not send to your email. Please try again.

Creating Digital Signature

Thread ID:

Created:

Updated:

Platform:

Replies:

54008 Dec 27,2006 06:03 AM Dec 28,2006 02:20 AM Windows Forms 1
loading
Tags: PDF
Ricardo
Asked On December 27, 2006 06:03 AM

I install a PFX file into my Certificate Store then I check the option that enable strong private key protection.
After this, I'm prompted with the CryptoAPI Private Key Windows Form wich I set my security level to High.

Executing the following code, the CryptoAPI ask me to insert the password.

Dim pdfDoc As Syncfusion.Pdf.PDFDocument
Dim provider As IPDFCertificateStore
Dim cert As IPDFCertificate
Dim signInfo As IPDFDigitalSignature
Dim rect As RectangleF

pdfDoc = PDFDocument.Load(strFilePath)
provider = pdfDoc.Security.GetCertificateStore(StoreType.MY)
cert = provider.FindBySubject(strFullname)

rect = New RectangleF(0, 0, 594, 200)
signInfo = pdfDoc.Security.CreateDigitalSignature(pdfDoc.LastPage, rect, cert)

pdfDoc.Save("d:\teste_" & GetGUID() & ".pdf")
pdfDoc.Close()


First question: If I press the cancel button the pdfDoc.Save(...) function generates a PDF with an invalid certificate.
How can I get this information programmaticaly?

Second question: If I insert the right password, and immediatly certificate different PDFs everything works fine, but is there any possiblity to prompt the password every time?


Note: I'm running the above code under a thread.


Thank's in advance!

Dhivya K [Syncfusion]
Replied On December 28, 2006 02:20 AM

Hi Ricardo,

Thanks for your detailed explanation and code snippets.

I tested the issue as follows
->installed the certificate as you said[set private key with high level security option]
-> when I signed the document,I clicked the "cancel" button.
I received the output PDF signed with the certificate that I have mentioned in my code with verifcation error which is expected as we didn't provide the password[pressed cancel button].

1) Regarding your first question, Pdf has been signed by the certificate that you have mentioned but with verification error. You can find the details of the certificate that has been signed by viewing the signature properties. However, I am not clear about the question you have asked. Can you please ellobrate about which information you want to get programmatically?
Here is a sample PDF document generated.
Sample.pdf


2) Regarding your second question,

Can you please clarify me whether you are trying to sign multiple PDF documents with a single certificate using threads?
If so is the case,it prompts for the password for each thread.
Here is a sample for your reference:
Multithreading.zip

Please let me know if my assumptions doen't meets your need. Also, Can you please provide me the Essential studio version your are using. This will help me investigating further on this issue.

Regards,
Dhivya.

CONFIRMATION

This post will be permanently deleted. Are you sure you want to continue?

Sorry, An error occured while processing your request. Please try again later.

You are using an outdated version of Internet Explorer that may not display all features of this and other websites. Upgrade to Internet Explorer 8 or newer for a better experience.

;