n0npr0phet / batesmaster

batesmaster open source pdf bates stamper
http://batesmaster.com/
15 stars 3 forks source link

NoClassDefFoundError: org/bouncycastle/asn1/ASN1OctetString #8

Open thiloplanz opened 13 years ago

thiloplanz commented 13 years ago

For certain kinds of PDF (containing signatures?), iText needs to have the Bouncy Castle crypto library available. If not, batesmaster will crash with an exception:

  Exception in thread "main" java.lang.NoClassDefFoundError: org/bouncycastle/asn1/ASN1OctetString
at com.lowagie.text.pdf.PdfEncryption.<init>(Unknown Source)
at com.lowagie.text.pdf.PdfReader.readDecryptedDocObj(Unknown Source)
at com.lowagie.text.pdf.PdfReader.readDocObj(Unknown Source)
at com.lowagie.text.pdf.PdfReader.readPdf(Unknown Source)
at com.lowagie.text.pdf.PdfReader.<init>(Unknown Source)
at com.lowagie.text.pdf.PdfReader.<init>(Unknown Source)
at com.batesmaster.batesStamper.ProcessDoc(batesStamper.java:156)
at com.batesmaster.Main.main(Main.java:125)

An example PDF that exhibits this behaviour can be found at http://www.deutsche-rentenversicherung-bund.de/cae/servlet/contentblob/33740/publicationFile/16757/C5001.pdf

thiloplanz commented 13 years ago

Just adding bouncycastle to the classpath unfortunately does not solve the problem. For the above sample PDF, you would just get the following instead:

com.lowagie.text.exceptions.BadPasswordException: PdfReader not opened with owner password
at com.lowagie.text.pdf.PdfStamperImp.<init>(Unknown Source)
at com.lowagie.text.pdf.PdfStamper.<init>(Unknown Source)
at com.batesmaster.batesStamper.ProcessDoc(batesStamper.java:162)
at com.batesmaster.Main.main(Main.java:145)

If it is really not possible to stamp the PDF, batesmaster should output an appropriate error message.