Quantcast

Nosuchmethod error for bouncy castle

classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Nosuchmethod error for bouncy castle

vinothkp
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.
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Nosuchmethod error for bouncy castle

Cosmin Ciuraru
Hello,

I remember coming across a similar error and I use 1.43 to avoid it.

2011/5/3 vinothkp <[hidden email]>
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
[hidden email]
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


------------------------------------------------------------------------------
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
[hidden email]
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Nosuchmethod error for bouncy castle

vinothkp
Cosmin, I tried searching for 1.43, but could not find it. google, bouncy website, its not there.

http://www.bouncycastle.org/latest_releases.html

if you do have it, can you please provide that jar to me somehow? or point me to somewhere (like and archive) i can download it from.

On Tue, May 3, 2011 at 1:13 PM, Cosmin Ciuraru [via iText - General] <[hidden email]> wrote:
Hello,

I remember coming across a similar error and I use 1.43 to avoid it.

2011/5/3 vinothkp <[hidden email]>
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
[hidden email]

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


------------------------------------------------------------------------------
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
[hidden email]
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


If you reply to this email, your message will be added to the discussion below:
http://itext-general.2136553.n4.nabble.com/Nosuchmethod-error-for-bouncy-castle-tp3492864p3493036.html
To unsubscribe from Nosuchmethod error for bouncy castle, click here.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Nosuchmethod error for bouncy castle

Cosmin Ciuraru
I remember that too. 


I just had to replace the 6 in 146 from the current version with the 3. OK, one would argue for a checksum.


------------------------------------------------------------------------------
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
[hidden email]
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 | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Nosuchmethod error for bouncy castle

vinothkp
Cosmin, that works thanks.

but i downloaded this file

http://grepcode.com/snapshot/repo1.maven.org/maven2/org.bouncycastle/bcprov-jdk15/1.43



On Tue, May 3, 2011 at 1:33 PM, Cosmin Ciuraru [via iText - General] <[hidden email]> wrote:
I remember that too. 


I just had to replace the 6 in 146 from the current version with the 3. OK, one would argue for a checksum.


------------------------------------------------------------------------------
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
[hidden email]
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


If you reply to this email, your message will be added to the discussion below:
http://itext-general.2136553.n4.nabble.com/Nosuchmethod-error-for-bouncy-castle-tp3492864p3493098.html
To unsubscribe from Nosuchmethod error for bouncy castle, click here.

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Nosuchmethod error for bouncy castle

Balder
We'll check the example to see to get it working with latest bc ( 1.46 ) release

On 3/05/2011 22:28, vinothkp wrote:
Cosmin, that works thanks.

but i downloaded this file

http://grepcode.com/snapshot/repo1.maven.org/maven2/org.bouncycastle/bcprov-jdk15/1.43



On Tue, May 3, 2011 at 1:33 PM, Cosmin Ciuraru [via iText - General] <[hidden email]> wrote:
I remember that too. 


I just had to replace the 6 in 146 from the current version with the 3. OK, one would argue for a checksum.


------------------------------------------------------------------------------
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
[hidden email]
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


If you reply to this email, your message will be added to the discussion below:
http://itext-general.2136553.n4.nabble.com/Nosuchmethod-error-for-bouncy-castle-tp3492864p3493098.html
To unsubscribe from Nosuchmethod error for bouncy castle, click here.



View this message in context: Re: Nosuchmethod error for bouncy castle
Sent from the iText - General mailing list archive at Nabble.com.



--

Kind Regards
Balder


redlab-log
@redlabbe

------------------------------------------------------------------------------
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
[hidden email]
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
Loading...