Spire.PDF is a professional PDF library applied to creating, writing, editing, handling and reading PDF files without any external dependencies. Get free and professional technical support for Spire.PDF for .NET, Java, Android, C++, Python.

Mon Nov 11, 2013 12:52 pm

Hi!
I need to verify all digital signatures on the existing PDF document. Is there any possibility to do it? The verification (in my case) means:
1) Get all digital signatures on the PDF
2) Check on each digital signature , whether the document wasn't changed (validity of the signature)
3) Check on each digital signature, whether the certificate is valid (this is not Spire.PDF's case, it's a standard .NET cryptography routine)

I would like to know how to solve the points 1 and 2. Could you help me, please?

Thanks for reply
Pavel

ales.klenka
 
Posts: 9
Joined: Thu Mar 22, 2012 9:30 am

Tue Nov 12, 2013 5:41 am

Hello Pavel,

Thanks for your inquiry.
Sorry that our products doesn't support the feature of getting digital signature on the existing PDF document, but we have added it into our schedule. Once the feature is supported in the future, we will inform you. Would you please provide us your pdf document if convenience? It would be helpful to do the research.

If there are any questions, welcome to get it back to us.

Sincerely,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Wed Nov 27, 2013 3:03 am

Hello Pavel,

So sorry for inconvenience. Now you could try the following method to get the digital signature on the PDF.
Code: Select all
string temp = @"..\..\output.pdf";
List<PdfSignature> signatures = new List<PdfSignature>();
using (var doc = new PdfDocument(temp))
            {
                var form = (PdfFormWidget)doc.Form;
                for (int i = 0; i < form.FieldsWidget.Count; ++i)
                {
                    var field = form.FieldsWidget[i] as PdfSignatureFieldWidget;

                    if (field != null && field.Signature != null)
                    {
                        PdfSignature signature = field.Signature;
                       
                        signatures.Add(signature);
                    }
                }
            }

If there are any questions, welcome to get it back to us.
Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Wed Nov 27, 2013 3:04 pm

Hello Gary,
Thank you for your answer, but I don’t see anywhere any property like „signature.IsValid“ (validity of the digital signature on PDF) and „signature.X509Certificate2“ – certificate of the signature (I need it for custom validation of the certificate chain).

Best regards

Pavel Stindl

ales.klenka
 
Posts: 9
Joined: Thu Mar 22, 2012 9:30 am

Thu Nov 28, 2013 3:17 am

Hello Pavel,

We have added it to our schedule, once it is supported in the future, we will inform you immediately.
If there are any questions, welcome to get it back to us.
Thanks,
Gary
E-iceblue support team
User avatar

Gary.zhang
 
Posts: 1380
Joined: Thu Apr 04, 2013 1:30 am

Return to Spire.PDF