Because something you are doing in the signing is creating an invalid PDF.

From: "Marco Barbi (SATA)" <[email protected]<mailto:[email protected]>>
Reply-To: Post here 
<[email protected]<mailto:[email protected]>>
Date: Mon, 19 Dec 2011 23:37:50 -0800
To: Post here 
<[email protected]<mailto:[email protected]>>
Subject: Re: [iText-questions] PDF signature fails in Adobe Reader

Hi,

actually that sample contained an XFA form, but the signature was included as 
an AcroForm field. Moreover, I tried with a very simple PDF (see attachment), 
with just an AcroForm signature field and no XFA based data, but the problem 
persists.
I wrote the signer code and I agree that the verifier isn't the problem, but I 
still cannot understand why iText gives a result where Adobe Reader fails.

Regards.
Marco

Il 19/12/2011 18.12, Leonard Rosenthol ha scritto:
Verifyier isn't your problem – it's the signer.

Did you write the code that signed this PDF?  Was it originally an XFA-based 
PDF and you tried to sign it as a regular PDF?

Leonard

From: "Marco Barbi (SATA)" <[email protected]<mailto:[email protected]>>
Reply-To: Post here 
<[email protected]<mailto:[email protected]>>
Date: Mon, 19 Dec 2011 08:31:35 -0800
To: Post here 
<[email protected]<mailto:[email protected]>>
Subject: [iText-questions] PDF signature fails in Adobe Reader

Hi,

I have a signed PDF document (see attachment) that iText libraries correctly 
verify but Adobe Reader doesn't since "Dict. object is expected". Please find 
below the code I use to validate the PDF with iText:

    KeyStore kall = PdfPKCS7.loadCacertsKeyStore();
    PdfReader reader = new PdfReader("C:/Documents and Settings/marco/My 
Documents/Temp/pdf_signed.pdf");
    AcroFields af = reader.getAcroFields();
    ArrayList names = af.getSignatureNames();
    for (int k = 0; k < names.size(); ++k) {
      String name = (String) names.get(k);
      System.out.println("Signature name: " + name);
      System.out.println("Signature covers whole document: " + 
af.signatureCoversWholeDocument(name));
      System.out.println("Document revision: " + af.getRevision(name) + " of " 
+ af.getTotalRevisions());
      // Start revision extraction
      FileOutputStream out = new FileOutputStream("revision_" + 
af.getRevision(name) + ".pdf");
      byte bb[] = new byte[8192];
      InputStream ip = af.extractRevision(name);
      int n = 0;
      while ((n = ip.read(bb)) > 0)
        out.write(bb, 0, n);
      out.close();
      ip.close();
      // End revision extraction
      PdfPKCS7 pk = af.verifySignature(name);
      Calendar cal = pk.getSignDate();
      Certificate pkc[] = pk.getCertificates();
      System.out.println("Subject: " + 
PdfPKCS7.getSubjectFields(pk.getSigningCertificate()));
      System.out.println("Document modified: " + !pk.verify());
      Object fails[] = PdfPKCS7.verifyCertificates(pkc, kall, null, cal);
      if (fails == null)
        System.out.println("Certificates verified against the KeyStore");
      else
        System.out.println("Certificate failed: " + fails[1]);
    }

Any hint?

Thank you.
Marco Barbi
--
Marco Barbi
S A T A srl
via Notari, 103 - 41126 Modena (ITALY)
Skype: marcobarbi
Tel: +39 059 343299 / +39 059 2928134
Fax: +39 059 2928134
Web: http://www.satanet.it



------------------------------------------------------------------------------
Learn Windows Azure Live!  Tuesday, Dec 13, 2011
Microsoft is holding a special Learn Windows Azure training event for
developers. It will provide a great way to learn Windows Azure and what it 
provides. You can attend the event by watching it streamed LIVE online.
Learn more at http://p.sf.net/sfu/ms-windowsazure



_______________________________________________
iText-questions mailing list
[email protected]<mailto:[email protected]>https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

--
Marco Barbi
S A T A srl
via Notari, 103 - 41126 Modena (ITALY)
Skype: marcobarbi
Tel: +39 059 343299 / +39 059 2928134
Fax: +39 059 2928134
Web: http://www.satanet.it
------------------------------------------------------------------------------
Write once. Port to many.
Get the SDK and tools to simplify cross-platform app development. Create 
new or port existing apps to sell to consumers worldwide. Explore the 
Intel AppUpSM program developer opportunity. appdeveloper.intel.com/join
http://p.sf.net/sfu/intel-appdev
_______________________________________________
iText-questions mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/itext-questions

iText(R) is a registered trademark of 1T3XT BVBA.
Many questions posted to this list can (and will) be answered with a reference 
to the iText book: http://www.itextpdf.com/book/
Please check the keywords list before you ask for examples: 
http://itextpdf.com/themes/keywords.php

Reply via email to