What happens when you sign with the latest release? That failure is usually caused by a corrupt PDF, it didn't even get to checking the signature.
Paulo ----- Original Message ----- From: "Michal Damborsky" <[EMAIL PROTECTED]> To: "itext-questions" <[email protected]> Sent: Sunday, March 18, 2007 4:33 PM Subject: [iText-questions] PDF sign - Error: The signature byte range isinvalid > Hi, > I have a problem with PDF signing. > > I use iText 1.4.7 (modified fod JDK 1.3) and BouncyCastle provider > combination (Domino 6.5 with Java 1.3.1). The problem is, that generated > PDF contains sign but in Adobe Reader got an Error: "Error during > signature verification. Unexpected byte range values defining scope of > signed data. Details: The signature byte range is invalid". > > Got same error on JDK 1.4. > > I really dont know, where is the problem. :( > > Thanks for any advice > > > > Source code: > ============================= > String certfile = "d:\\ipov\\cert\\cert.pfx"; > String pdffile = "d:\\ipov\\test\\pokus.pdf"; > > KeyStore ks = KeyStore.getInstance("pkcs12","BC"); > ks.load(new > FileInputStream(certfile),"heslo".toCharArray()); > String alias = (String)ks.aliases().nextElement(); > PrivateKey key = (PrivateKey)ks.getKey(alias, > "heslo".toCharArray()); > java.security.cert.Certificate[] chain = > ks.getCertificateChain(alias); > PdfReader reader = new PdfReader(pdffile); > FileOutputStream fout = new FileOutputStream( > "d:\\ipov\\test\\pokusEx.pdf"); > PdfStamper stp = PdfStamper.createSignature(reader, > fout,'\0'); > PdfSignatureAppearance sap = stp.getSignatureAppearance(); > sap.setCrypto(key, chain, null, > PdfSignatureAppearance.WINCER_SIGNED); > sap.setReason("Reason"); > sap.setLocation("Location"); > > > sap.setVisibleSignature(new Rectangle(100, 150, 200,200), 1, null); > > stp.close(); > =============================== > > Michal -------------------------------------------------------------------------------- > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV -------------------------------------------------------------------------------- > _______________________________________________ > iText-questions mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/itext-questions > Buy the iText book: http://itext.ugent.be/itext-in-action/ > ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ iText-questions mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/itext-questions Buy the iText book: http://itext.ugent.be/itext-in-action/
