Hi, i followed the code snippet provided in iText in Action book. and when i
run the following code, i get a java.lang.NoSuchMethodError:
org.bouncycastle.asn1.DERSequence.<init>(Lorg/bouncycastle/asn1/DEREncodableVector;)V
exception


KeyStore ks = KeyStore.getInstance("pkcs12");
String alias = "aprivatekey";
FileInputStream fis = new FileInputStream(keystoreFilePath);
BufferedInputStream bufin = new BufferedInputStream(fis);  
ks.load(bufin, password.toCharArray());
PrivateKey pk = (PrivateKey)ks.getKey(alias, password.toCharArray());
Certificate[] chain = ks.getCertificateChain(alias);


PdfReader reader = new PdfReader(filename1);
PdfStamper stamper = PdfStamper.createSignature(reader, new
FileOutputStream(filename2), '\0', null, true);
PdfSignatureAppearance appearance = stamper.getSignatureAppearance();
appearance.setVisibleSignature("mySig");
appearance.setReason("It's something");
appearance.setLocation("MD");
appearance.setCrypto(pk, chain, null, PdfSignatureAppearance.WINCER_SIGNED);    
appearance.setCertificationLevel(PdfSignatureAppearance.CERTIFIED_NO_CHANGES_ALLOWED);

stamper.close();
reader.close();


The code throws the exception when calling stamper.close();

Another post talks about bouncycastle version. I tried using bouncycastle
jar version 1.46 and 1.38. Same exception. What would be the exact version
of bouncycastle that will support iText?

Why is the exception being thrown?

Thanks in advance.

--
View this message in context: 
http://itext-general.2136553.n4.nabble.com/Nosuchmethod-error-for-bouncy-castle-tp3492864p3492864.html
Sent from the iText - General mailing list archive at Nabble.com.

------------------------------------------------------------------------------
WhatsUp Gold - Download Free Network Management Software
The most intuitive, comprehensive, and cost-effective network 
management toolset available today.  Delivers lowest initial 
acquisition cost and overall TCO of any competing solution.
http://p.sf.net/sfu/whatsupgold-sd
_______________________________________________
iText-questions mailing list
iText-questions@lists.sourceforge.net
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