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.

Wed Apr 23, 2025 11:13 am

Hello
I'm signing a document with a PFX file.
The PDF is showing a yellow tick mark in the "Signature" panel, with a message :
"signer's identity is unknown because it has not been included in your list of trusted certificates and none of its parent certificates are thrusted certificates"

The PFX provider belongs to the European Trusted List (EUTL), and is in my trusted list in adobe(screenshot attached)
certutil show 3 certificates in the pfx, include a root one. (screenshot attached)
In the PDF the certificate show only my own certificate and not the chain. (screenshot attached)

The code to perform the signing is the following :
Code: Select all
         // load document
         PdfDocument document = new PdfDocument();
         document.loadFromStream(is);

         // load certificate (pfx file)
         pdfCertficat = getCertificate(certificateFile, certificatePassword, responses);
         if (pdfCertficat == null) {
            return responses;
         }

         // sign the PDF
         PdfSignature signature = new PdfSignature(document,
               document.getPages().get(document.getPages().getCount() - 1), pdfCertficat, signerName);

         // manage the timestamp
         signature.configureTimestamp("http://timestamp.digicert.com");
         signature.configureHttpOCSP(null, null);

         // Set the document permission to forbid changes
         signature.setDocumentPermissions(PdfCertificationFlags.Forbid_Changes);
         signature.setCertificated(true);


additional informations:
    Java - version 21.0.6 by Eclipse Adoptium
    spire.pdf for java- version 11.3.5 by E-iceblue Co., Ltd

GuiPATRY
 
Posts: 35
Joined: Wed Feb 17, 2021 10:18 am

Thu Apr 24, 2025 2:25 am

Hello,

Thanks for your inquiry.
Please try signing with the code below and verify if your issue persists. If it does, please provide us with your complete test code and signing certificate and password to help us investigate further. You can upload them to the attachment or send them to this email address: [email protected]. Thanks in advance.
Code: Select all
public static void main(String[] args) throws IOException {
    PdfDocument doc = new PdfDocument();
    doc.loadFromFile("data/Input.pdf");
    PdfCertificate cert = new PdfCertificate("data/test.pfx", "password");
    //Create signature maker
    PdfOrdinarySignatureMaker signatureMaker = new PdfOrdinarySignatureMaker(doc, cert);
    //Custom appearance
    PdfCustomAppearance customAppearance=new PdfCustomAppearance();
    signatureMaker.setAcro6Layers(false);
    signatureMaker.makeSignature("signName", doc.getPages().get(doc.getPages().getCount() - 1), 40, 200, 200, 80, customAppearance);
    doc.saveToFile("result.pdf", FileFormat.PDF);
}
class PdfCustomAppearance implements IPdfSignatureAppearance
    {
        @Override
        public void generate(PdfCanvas pdfCanvas) {
            float x = 2;
            float y = 2;
            int fontSize = 10;
            PdfTrueTypeFont font = new PdfTrueTypeFont(new Font("Arial", Font.PLAIN,fontSize));
            float lineHeight = fontSize;
            pdfCanvas.drawString("Digitally signed by BHFL", font, PdfBrushes.getRed(), new Point2D.Double(x, y));
            y+=lineHeight;
            pdfCanvas.drawString("Reason: Internal Sign", font, PdfBrushes.getRed(), new Point2D.Double(x, y));
            y+=lineHeight;
            pdfCanvas.drawString("Date:"+ DateTime.getNow(), font, PdfBrushes.getRed(), new Point2D.Double(x, y));
        }
    }


Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 732
Joined: Mon Dec 27, 2021 2:23 am

Fri Apr 25, 2025 9:08 am

Hello

I sent you the informations via mail.

Regards
Guillaume

GuiPATRY
 
Posts: 35
Joined: Wed Feb 17, 2021 10:18 am

Fri Apr 25, 2025 9:34 am

Hello,

Thanks for your message.
I have sent my reply to your email. Kindly review it at your convenience.

Sincerely,
William
E-iceblue support team
User avatar

William.Zhang
 
Posts: 732
Joined: Mon Dec 27, 2021 2:23 am

Return to Spire.PDF