Not able to set BouncyCastle as most preferred provider in JCE
843811Jan 25 2006 — edited Jan 26 2006Was trying to set BouncyCastle as the most preferred provider in JCE
via the follwing code :
Class BC = Class.forName( "org.bouncycastle.jce.provider.BouncyCastleProvider");
Security.insertProviderAt((Provider)BC.newInstance(), 1);
and got the following exception :
Exception in thread "main" java.lang.ExceptionInInitializerError
at javax.crypto.KeyGenerator.getInstance(DashoA6275)
at RC2Test.main(RC2Test.java:32)
Caused by: java.lang.SecurityException: Cannot set up certs for trusted CAs
at javax.crypto.SunJCE_b.<clinit>(DashoA6275)
... 2 more
Caused by: java.security.PrivilegedActionException: java.security.InvalidKeyException: Public key presented not for certificate signature
at java.security.AccessController.doPrivileged(Native Method)
... 3 more
Caused by: java.security.InvalidKeyException: Public key presented not for certificate signature
at org.bouncycastle.jce.provider.X509CertificateObject.verify(X509CertificateObject.java:658)
at javax.crypto.SunJCE_b.c(DashoA6275)
at javax.crypto.SunJCE_b.b(DashoA6275)
at javax.crypto.SunJCE_s.run(DashoA6275)
... 4 more
Refrd to the thread dated : Aug 6, 2003 6:12 AM
(Bouncy castle errors with cipher.getinstance() )
My work so demands that i should be able to set BouncyCastle as the most preferred provider . Kindly provider pointers to this issue .
Thanks