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.

Thu Jan 25, 2018 3:37 pm

Hello people,
I am having a problem with the NuGet package Spire.PDF. Namely, signatureOne.VerifySignature() throws an exception for a valid signed document.
I am using the latest version of Spire.PDF NuGet package (version 3.9.604, publish date 1/19/2018).

This is the code I used to validate it:

Code: Select all
            string path = @"D:\Pact(3).pdf";
            var signatures = new List<PdfSignature>();
            bool signitureIsValid;

            using (var doc = new PdfDocument(path))
            {
                var form = (PdfFormWidget) doc.Form;
                for (int i = 0; i < form.FieldsWidget.Count; ++i)
                {
                    if (form.FieldsWidget[i] is PdfSignatureFieldWidget field && field.Signature != null)
                    {
                        PdfSignature signature = field.Signature;
                        signatures.Add(signature);
                    }
                }
                try
                {
                    PdfSignature signatureOne = signatures[0];
                    signitureIsValid = signatureOne.VerifySignature(); //Exception thrown for valid signature ! Why ?!
                }
                catch (Exception ex)
                {
                    Console.WriteLine(ex);
                    Console.WriteLine(ex.StackTrace);
                    Debug.WriteLine(ex);
                }
            }


The exception thrown is not very intelligible or helpful, it just states that signature 'sirnature1' failed to validate without giving any clue as to why this is happening...

Here is some of the output text of the exception:

System.ArgumentException: Signature 'Signature1' failed to verified.
at spr?.?(String A_0)
at Spire.Pdf.Security.PdfSignature.VerifySignature()
at PDFTest.Program.Main(String[] args) in ....

Could you please give me some ways of troubleshooting this problem ?
Respectfully,
Zoran

ZoranHgt
 
Posts: 10
Joined: Tue Jan 16, 2018 1:18 pm

Fri Jan 26, 2018 2:15 am

Hi Zoran,

Thanks for your inquiry.
To help us detect the cause and find the solution more quickly, could you please send your sample file to us([email protected])?

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Fri Jan 26, 2018 9:36 am

Dear Jane,

U have done as you asked, and sent the document to your support team ([email protected]).
Thank you for your quick reply.

When might I expect your team to contact me?
Time is of the essence.

Respectfully,
Zoran

ZoranHgt
 
Posts: 10
Joined: Tue Jan 16, 2018 1:18 pm

Fri Jan 26, 2018 10:00 am

Hi Zoran,

I had already replied you in the email.
After an initial test, there’s no exception thrown on my side. Yet the “VerifiSignature()”  always returns false,
that means the signature is invalid, but I found the signature in your document is in fat valid.  
For the exception issue, could you please provide the following information to help us reproduce the case.
1. Region and Language setting in your system.
2. The OS information of the test environment, e.g. Serve 2012 R2.
When I reproduced the cases, I will delivered them to our dev team together.
 
Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Fri Jan 26, 2018 10:37 am

Dear Jane,

the region and language is English (United States),
the OS information is Windows 7 Professional SP1

Respectfully,
Zoran

ZoranHgt
 
Posts: 10
Joined: Tue Jan 16, 2018 1:18 pm

Mon Jan 29, 2018 7:53 am

Hello Zoran,

Thanks for the details and sorry for the late reply due to the weekend day off.
With the same environment, I still got the same result as before.
Could you please check if you are using the correct version or if the document you sent to me is the one you are using?
I just created a project to show the result at my end, the dlls I referenced are the latest one, because the v3.9.604 returns the same result.
Below is the download link of my project.
http://www.e-iceblue.com/downloads/attachment/12723.zip

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Mon Jan 29, 2018 1:39 pm

Dear Jane,

sorry for the late reply, I had a lot of meetings in the morning, and just now got back to my desk.
First of, yes, the document I sent to you is the one I am using, there is no other.

I have downloaded your project and the results are the same on my end as before, namely,
it throws the same exception as before.

I have sent you screenshots of this via e-mail.

Respectfully,
Zoran

ZoranHgt
 
Posts: 10
Joined: Tue Jan 16, 2018 1:18 pm

Mon Jan 29, 2018 1:47 pm

Here are the images:

Image

Image

ZoranHgt
 
Posts: 10
Joined: Tue Jan 16, 2018 1:18 pm

Mon Jan 29, 2018 1:48 pm

Last edited by ZoranHgt on Tue Jan 30, 2018 9:43 am, edited 1 time in total.

ZoranHgt
 
Posts: 10
Joined: Tue Jan 16, 2018 1:18 pm

Tue Jan 30, 2018 7:35 am

Hi Zoran,

Thank you for the response.
I have managed to reproduce the issue on my side and referred it to our dev team for fixing.
Once there's any update, I will let you know.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Tue Jan 30, 2018 9:42 am

Dear Jane,

I am happy to hear this ! :)
Thank you for your time and effort.
Hope to hear from you soon.

Sincerely,
Zoran

ZoranHgt
 
Posts: 10
Joined: Tue Jan 16, 2018 1:18 pm

Fri Feb 09, 2018 8:29 am

Dear Jane,
I am pleased to inform you that Spire.PDF NuGet (version 4.2.4) is working properly,
Great job to you and your development team! Cheers!

Gratefully,
Zoran :)

ZoranHgt
 
Posts: 10
Joined: Tue Jan 16, 2018 1:18 pm

Sun Feb 11, 2018 3:25 am

Hi Zoran,

Glad to hear that.
Please feel free to contact us if you need any assistance in the future.

Sincerely,
Jane
E-iceblue support team
User avatar

Jane.Bai
 
Posts: 1156
Joined: Tue Nov 29, 2016 1:47 am

Return to Spire.PDF