Incorrect value from VerifySignature

Hello,

I am encountering 2 problems while using aspose pdf while adding and validating certificates.

1.After adding certificate via aspose and opening the document in acrobat reader, I see the message 'Certificate by *** is invalid"
2. When trying to read Validity of the document by VerifySignature, it shows up as valid.

This is only happening with few documents. Can you help me catch this error in aspose.

Thank you
Sucharitha Koleti

@epitec

Would you please share the sample source files (PDF and Certificate files) along with sample code snippet? We will test the scenario in our environment and address it accordingly.

CertificationBug.zip (3.0 KB)
Region-InvalidCertificate.jpg (128.5 KB)
Alabama W4.pdf (151.1 KB)
Hello,
Thank you for the response. here is the sample code.
Code contains two workflows

  1. Region ‘#region InvalidCertificate’ is our primary road block. We are unable to figure out why
  • Certificate is invalid when text fragment is added. Adobe Reader displays Certificate is invalid.

  • Aspose ‘VerifySignature’ returns as Valid Certificate. We are unable to extract correct value of Certificate validity programmatically.

  1. Workflow: Region- MissingTextFragment-ValidCertificate
    When no text fragment is added, Certificate shows up as valid in both Aspose and Adobe Reader. We are unable to figure out why
  • Text fragment is deleted from pdf document

Thank you
Sucharitha Koleti

@epitec

We noticed that the certificate file was missing in the resources that you shared. Could you please also share the Certificate file for our reference so that we can test the scenario in our environment and address it accordingly?

@asad.ali,

Here is the test pfx file and password.
Password: Password123

TestCert.zip (2.6 KB)
InvalidCertificate.jpg (173.9 KB)

@epitec

We were able to notice similar behavior at our end while testing the scenario. However, when we imported the certificate file that you shared, Adobe Reader showed the PDF with valid certificate. Please note that the certificates must be added to Trusted Certificate List of Adobe Reader in order to let it recognize and validate the PDF. Please try to double-click the certificate file and follow the wizard to import it so that it can be added to trusted store. Please feel free to let us know if you have more concerns.

Hello @asad.ali,

I am positive that the certificate is added to trusted list in Adobe. The issue is about adobe invalidating the the document due to ‘The Document has been altered or corrupted since the Certification was applied’ as shared in the screen shot.

This is happening after making these changes in sequence: 1. Adding paragraph to existing pdf. 2. Adding certificate to modified pdf.

Can you please confirm if you are able to replicate the issue.

Thank you
Sucharitha KoletiInvalidCertificate-More Info.jpg (103.8 KB)

@epitec

We tested the scenario by running your shared application with 21.7 version of the API. At the first time, the generated PDF (alabama-testing.pdf) was showing invalid certificate. We imported the TestCert.pfx file in our system by double-clicking on it and after that the Adobe Reader was showing the certificate as valid one. We tried to run your application multiple times and each time the output PDF shows valid certificate in Adobe Reader. Could you please share some more steps on how to reproduce the same issue that you are facing?