Friday, September 14, 2012

crash Could not start CRaSSHD Failed to register BouncyCastle as the defaut JCE provider

Problem:

I deployed crash.war in JBoss and  I’ve the following error : Could not start CRaSSHD

10:22:31,335 INFO  [SSHPlugin] Booting SSHD
10:22:32,826 INFO  [SecurityUtils] Trying to register BouncyCastle as a JCE provider
10:22:36,861 SEVERE [SecurityUtils] Failed to register BouncyCastle as the defaut JCE provider
10:22:36,862 SEVERE [SSHLifeCycle] Could not start CRaSSHD

java.lang.RuntimeException: Failed to register BouncyCastle as the defaut JCE provider


Caused by: java.security.NoSuchProviderException: JCE cannot authenticate the provider BC
       at javax.crypto.SunJCE_b.a(DashoA13*..)
       at javax.crypto.KeyAgreement.getInstance(DashoA13*..)
       at org.apache.sshd.common.util.SecurityUtils$BouncyCastleRegistration.run(SecurityUtils.java:97)
       at org.apache.sshd.common.util.SecurityUtils.register(SecurityUtils.java:77)
       ... 79 more
Caused by: java.util.jar.JarException: Cannot parse jar:file:/opt/jboss/jboss-eap-5.1/jboss-as/server/all/deploy/crash.war!/WEB-INF/lib/bcprov-jdk16-1.46.jar


Solution :

- Download  bouncycastle library at http://www.bouncycastle.org/latest_releases.html (For me its bcprov-jdk15on-147.jar and bcprov-ext-jdk15on-147.jar).

- Copy theses files (eg: bcprov-jdk15on-147.jar and bcprov-ext-jdk15on-147.jar) in /path_to_your_jvm/jre/lib/ext. (e.g: /opt/jdk/jdk1.6.0_18/jre/lib/ext)
- vi /path_to_your_jvm/jre/lib/security/java.security and add the following line : security.provider.9=org.bouncycastle.jce.provider.BouncyCastleProvider

java.security

security.provider.1=sun.security.provider.Sun
security.provider.2=sun.security.rsa.SunRsaSign
security.provider.3=com.sun.net.ssl.internal.ssl.Provider
security.provider.4=com.sun.crypto.provider.SunJCE
security.provider.5=sun.security.jgss.SunProvider
security.provider.6=com.sun.security.sasl.Provider
security.provider.7=org.jcp.xml.dsig.internal.dom.XMLDSigRI
security.provider.8=sun.security.smartcardio.SunPCSC
security.provider.9=org.bouncycastle.jce.provider.BouncyCastleProvider

- Restart jboss.

http://www.randombugs.com/java/javalangsecurityexception-jce-authenticate-provider-bc.html
http://nyal.developpez.com/tutoriel/java/bouncycastle/#L1

http://julienviet.com/crash/

No comments:

Post a Comment