Java: How to verify PDF digital signature (similar to green check mark in Adobe Acrobat Reader)

I have a PDF that has been digitally signed by DocuSign.

I can open this in Adobe Acrobat Reader and view the green checkmark, indicating that the signer’s identity is trusted, and the document hasn’t been modified since it was signed.

How can I accomplish this same functionality using Aspose PDF for Java?

Here is an example digitally signed PDF from Adobe: https://blogs.adobe.com/security/SampleSignedPDFDocument.pdf

@jamesddaily

Thank you for contacting support.

You may check the validity of PDF signatures with below code snippet in your environment. However, the signatures in this particular PDF file, shared by you, are not validated by the API. This is a file specific problem and is already logged in our issue management system with ID PDFNET-43228. So you may try to validate some other PDF files by using shared code snippet and then share your kind feedback with us.

Document PDF_Doc = new Document(dataDir + "DocumentToValidate.pdf");
com.aspose.pdf.facades.PdfFileSignature PFS1 = new 
com.aspose.pdf.facades.PdfFileSignature(PDF_Doc);
if (PFS1.getSignNames().size() > 0)
{
  for (String Cert_00:PFS1.getSignNames())
  {
   if (PFS1.verifySigned(Cert_00))
       System.out.println("Valid");
   else
       System.out.println("Not Valid !!!");
 }
} 

We hope this will be helpful. Please feel free to contact us if you need any further assistance.

1 Like

Great, thank you.

Here is a DocuSign-signed PDF, for comparison: This_is_a_sample_DocuSigned_document.pdf (121.4 KB)

@jamesddaily

Thank you for getting back to us.

We have updated shared data under respective ticket and will notify you once the ticket will be resolved.

1 Like