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. Image for the cookie policy date

Long duration in PDF signatures validation

I use the PDF library to validate signature. The code I'm using is basic.

List<PdfSignatureValidationResult> results;

isSignatureValid = form.Fields.ValidateSignatures(out results);


I've tested a lot of PDF file and it works fine. In few specific PDF files, the 'ValidateSignatures' takes about 15 seconds.

I tried also to disable validate revocation 

isSignatureValid = form.Fields.ValidateSignatures(

                        new PdfSignatureValidationOptions { ValidateRevocationStatus = false},

                        out results);

Is there a way to find out what takes so long with the problematic PDF files?



7 Replies 1 reply marked as answer

IJ Irfana Jaffer Sadhik Syncfusion Team February 2, 2023 09:31 AM UTC

Query:  Is there a way to find out what takes so long with the problematic PDF files?

As you have mentioned, the specific exception occurs with a few specific PDF files. We need to analyze the pdf structure programmatically and to check whether the reported issue occurs with the signature or the specific pdf document. Can you provide a confidential dummy signed document that caused the specific exception you mentioned, so we can investigate the issue and assist you further in this?



DB Dan Barack February 5, 2023 07:27 AM UTC

Attached a file that has the problem. The verify operation takes 15 seconds.

Please investigate what can it be.


Attachment: long_verify_example_c1477d5d.zip


IJ Irfana Jaffer Sadhik Syncfusion Team February 6, 2023 12:13 PM UTC

Thank you for sharing the details. We are internally validating the certificate revocation details using web request. The customer provided document signed certificate has both the OCSP and CRL details. we are internally trying to verify the OCSP and CRL data.   the time taken is based on the network speed [it may vary on network speed]. This is the reason to validating the certificates take some amount of time. 

we have the option to omit the Certificate Revocation List (CRL), and Online Certificate Status Protocol (OCSP) while signing the PDF document and validating the signature from the PDF document in our library.

using (var loadedDocument = new PdfLoadedDocument("../../Empty.pdf"))

            {

 

                var signature = new PdfSignature(

                   loadedDocument,

                   loadedDocument.Pages[loadedDocument.Pages.Count - 1],

                   certificate,"Signature");

 

                signature.LocationInfo = " ";

                signature.Reason = " ";

                signature.EnableLtv = false;

               

                signature.DocumentPermissions = PdfCertificationFlags.AllowFormFill

                                                | PdfCertificationFlags.AllowComments

                                                | PdfCertificationFlags.ForbidChanges;

                signature.SignedName = "Syncfusion";

                loadedDocument.Save("../../Signed.pdf");

 

            }


For signature validation, we requested you to disable the ValidateRevocationStatus property while validating a signature.


PdfLoadedDocument loadedDocument = new PdfLoadedDocument("../../Signed.pdf");

 

            PdfSignatureValidationOptions validationOptions = new PdfSignatureValidationOptions();

            validationOptions.ValidateRevocationStatus = false;

 

            List<PdfSignatureValidationResult> results;

            if(loadedDocument.Form!=null && loadedDocument.Form.Fields.Count>0)

            loadedDocument.Form.Fields.ValidateSignatures(validationOptions, out results);

 

            //Close the document

 

            loadedDocument.Close(true);


Please refer to the below UG documentation about LTV,

https://help.syncfusion.com/file-formats/pdf/working-with-digitalsignature#enable-long-term-validation-ltv-pdf-signature



Marked as answer

DB Dan Barack February 6, 2023 01:56 PM UTC

Hi Irfana ,

The pdf that I have sent you has not been signed with Syncfusion, I only run the ValidateSignatures on it.

I already disabled ValidateRevocationStatus and it does not help.

I am still facing the same problem, the method ValidateSignatures() takes 15 seconds with this specific PDF.




IJ Irfana Jaffer Sadhik Syncfusion Team February 7, 2023 07:36 AM UTC

We have checked the reported issue with the provided details on our end and it was working properly. We have included a sample and a video demonstrating the steps we took to replicate the issue.

video: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ScreenCapture_2-7-2023_12.44.51_PM.mp4752635623

sample: https://www.syncfusion.com/downloads/support/directtrac/general/ze/ConsoleSample453210260

We request you check this and confirm whether you are following the same steps or not. If still you are facing the issue, 

Please share with us the following details to check the issue from our side,

  1. List of Syncfusion NuGet packages, assemblies used, and their version.
  2. TargetFrameWork and Platform of your application

So, that we can assist you further with this

https://www.syncfusion.com/downloads/support/directtrac/general/ze/ConsoleSample453210260



DB Dan Barack February 7, 2023 04:55 PM UTC

I checked with your source code and on my computer I get the extra 15 seconds.


Regarding you questions:

  1. Syncfusion.Pdf.Net.Core 20.4.0.44 
  2. TargetFrameWork : .NET6
  3. Platform target : AnyCPU

What else can it be?
Thanks in avanced



IJ Irfana Jaffer Sadhik Syncfusion Team February 8, 2023 11:05 AM UTC

We have created a new ticket under your account to follow up on this query. We suggest you follow up with the ticket for further updates. Please log in using the below link.

https://support.syncfusion.com/support



Loader.
Live Chat Icon For mobile
Up arrow icon