PdfException when Verifying a signature

Hello,
We are using Aspose.PDF.Drawing 24.9.0.
The attached documet contains signature field "5.3 Signature " signed with a digital signature.

When calling PdfFileSignature.VerifySigned("5.3 Signature "), the following exception is thrown by Aspose:

Aspose.Pdf.PdfException: 'Signature field ‘3 Signature ’ is not defined.’

@tfipsrd

The exception you are encountering, Aspose.Pdf.PdfException: 'Signature field '3 Signature ' is not defined.', suggests that the signature field you are trying to verify does not exist in the PDF document. Here are a few steps you can take to troubleshoot and resolve this issue:

  1. Check the Signature Field Name: Ensure that the name of the signature field you are passing to the VerifySigned method matches exactly with the name defined in the PDF. In your case, you are using "5.3 Signature ", but the error message refers to '3 Signature '. This discrepancy indicates that there might be a typo or a mismatch in the field name.

  2. List All Signature Fields: You can list all the signature fields in the PDF to verify their names. This can help you confirm the exact name of the signature field you want to verify. Here’s a code snippet to list all signature fields:

    PdfFileSignature pdfSign = new PdfFileSignature();
    pdfSign.BindPdf("path_to_your_pdf.pdf");
    foreach (var field in pdfSign.GetSignatureFieldNames())
    {
        Console.WriteLine(field);
    }
    pdfSign.Close();
    
  3. Verify the Signature: Once you have confirmed the correct name of the signature field, use that name in the VerifySigned method. For example:

    if (pdfSign.VerifySigned("correct_signature_field_name"))
    {
        Console.WriteLine("Signature Verified");
    }
    
  4. Check for Multiple Signatures: If your document contains multiple signatures, ensure that you are referencing the correct one. Each signature field must be uniquely named.

By following these steps, you should be able to identify the issue with the signature verification process. If the problem persists, consider checking the PDF document for any corruption or issues with the signature itself.

If you need further assistance, feel free to ask!

Thanks for hints,

Indeed, the signature field was not within the list returned by PdfFileSignature.GetSignNames()

If I do this:

            var signames = pdfFileSignature.GetSignNames(false);
            signatureField.Settings.IsValid = pdfFileSignature.VerifySigned(signames[1]);

I now get the following exception:
System.ArgumentException: 'Form field not found : 3 Signature ’

20211012Formulaire Séminaire externe -FRSignedWithAdobe2.pdf (671.1 KB)

@tfipsrd

Would you please share the complete stack trace information as well? It will help us in investigating the issue accordingly.

image.png (8.3 KB)

@tfipsrd

We have opened the following new ticket(s) in our internal issue tracking system and will deliver their fixes according to the terms mentioned in Free Support Policies.

Issue ID(s): PDFNET-58243

You can obtain Paid Support Services if you need support on a priority basis, along with the direct access to our Paid Support management team.