BouncyCastle not registered
2016-03-25 16:33
295 查看
I'm trying to run a SSHD demo, but encountered the 'BouncyCastle not registered' error:
Tried [1] method, but failed.
Then tried [2],
- Download bouncycastle library at http://www.bouncycastle.org/latest_releases.html (For me its bcprov-jdk15on-154.jar and bcprov-ext-jdk15on-154.jar).
- Copy theses files (eg: bcprov-jdk15on-154.jar and bcprov-ext-jdk15on-154.jar) in /path_to_your_jvm/jre/lib/ext. (e.g: /opt/jdk/jdk1.8.0_40/jre/lib/ext)
edit /path_to_your_jvm/jre/lib/security/java.security and add the following line : security.provider.11=org.bouncycastle.jce.provider.BouncyCastleProvider
this method works, the output is:
References:
[1] http://stackoverflow.com/questions/8171802/using-bouncycastle-for-a-simple-https-query
[2] http://totalprogus.blogspot.hk/2012/09/crash-could-not-start-crasshd-failed-to.html
import java.io.File; import java.io.IOException; import org.apache.sshd.server.SshServer; import org.apache.sshd.server.keyprovider.SimpleGeneratorHostKeyProvider; import org.apache.sshd.server.shell.ProcessShellFactory; public class MollySshServerMock { public static void main(String[] args) throws IOException { SshServer sshd = SshServer.setUpDefaultServer(); sshd.setPort(22); sshd.setKeyPairProvider(new SimpleGeneratorHostKeyProvider(new File("hostkey.ser"))); sshd.setShellFactory(new ProcessShellFactory(new String[] { "/bin/sh", "-i", "-l" })); sshd.start(); } }The error:
[main] INFO org.apache.sshd.common.util.SecurityUtils - BouncyCastle not registered, using the default JCE providerThe environment: Windows 7 64bit, STS 3.7.2, JDK 1.8
Tried [1] method, but failed.
Then tried [2],
- Download bouncycastle library at http://www.bouncycastle.org/latest_releases.html (For me its bcprov-jdk15on-154.jar and bcprov-ext-jdk15on-154.jar).
- Copy theses files (eg: bcprov-jdk15on-154.jar and bcprov-ext-jdk15on-154.jar) in /path_to_your_jvm/jre/lib/ext. (e.g: /opt/jdk/jdk1.8.0_40/jre/lib/ext)
edit /path_to_your_jvm/jre/lib/security/java.security and add the following line : security.provider.11=org.bouncycastle.jce.provider.BouncyCastleProvider
this method works, the output is:
[main] INFO org.apache.sshd.common.util.SecurityUtils - BouncyCastle already registered as a JCE provider
References:
[1] http://stackoverflow.com/questions/8171802/using-bouncycastle-for-a-simple-https-query
[2] http://totalprogus.blogspot.hk/2012/09/crash-could-not-start-crasshd-failed-to.html
相关文章推荐
- 最长公共子子串 java
- [转]SpringMVC日期类型转换问题三大处理方法归纳
- JAVA基础--继承和权限控制
- mysql各种引擎的比较
- 函数模板
- 语音识别工具箱之HTK安装与使用
- Tomcat 部署war文件
- android剪切成圆形图片CircleBitmap
- <转载>Js中Prototype、__proto__、Constructor、Object、Function关系介绍
- yum安装mongodb
- JAVA IO流
- url各部分组成分解
- 工厂模式的简单实现和快速理解--------(java复习)
- linux高端内存映射
- leetcode-11 Container With Most Water
- HDU 1080 Human Gene Functions(带权值的最长公共子序列)
- UDP协议的两个主要方法sendto和recvfrom详解
- error: No resource identifier found for attribute 'cardCornerRadius' in package XXXXXX
- 朴素模式匹配算法java实现
- leetcode-12 Integer to Roman