cnnic根证书(root)的不可信与解决办法

作者: 2hei 发表于2010年4月 8日 15:50
版权声明: 可以转载, 转载时务必以超链形式标明文章原始出处和作者信息及版权声明
http://www.2hei.net/mt/2010/04/cnnic-root-certificate.html

cnnic使用了自己的根证书CNNIC ROOT和中级根证书CNNIC SSL,(好多人都在抵制cnnic root哦!,不过既然boss同意使用CNNIC证书,那俺也只能照办了~)

3月1日以后替换的证书都需要替换之前Entrust授权的ROOT。

但是一些主、客观上的原因导致并不是所有的浏览器或者客户端都认为cnnic的根证书是合法可信的,比如firefox3.0。还有java客户端,如我的实际情况是在配置完毕后使用浏览器访问https没有问题,但是使用java的HttpURLConnection调用时,web端有以下错误日志:

[Wed Apr  7 15:25:10 2010] [error] mod_ssl: SSL handshake failed (server 2hei.net:443, client 218.241.111.117) (OpenSSL library error follows)
[Wed Apr  7 15:25:10 2010] [error] OpenSSL: error:14094416:SSL routines:SSL3_READ_BYTES:sslv3 alert certificate unknown

看结果貌似java不识别cnnic为truststore。


经过与cnnic的support沟通后,得到了解决方案,总结如下:

1、use keytool to export the server certificate from the certs keystore.
#keytool -export -keystore certs -alias jamie -file server.cer
也可以使用IE浏览器导出base64的server.cer文件。

2、Use keytool to create a new keystore named jssecacerts (which will be used as a truststore by SecureBrowser). Import server.cer into jssecacerts.
#keytool -import -keystore jssecacerts -alias jamie -file server.cer


3、Finally, copy jssecacerts to the lib/security subdirectory of your java.home directory. (On your client machine.)

Now SecureBrowser will use jssecacerts as a truststore to authenticate SecureServer.

4、edit java code,add this:
// Register JSSE
Security.addProvider(new com.sun.net.ssl.internal.ssl.Provider()) ;
// Simply set the protocol handler property to use SSL.
System.setProperty("java.protocol.handler.pkgs","com.sun.net.ssl.internal.www.protocol");

参考文档
http://onjava.com/pub/a/onjava/2001/05/03/java_security.html?page=4

| | Comments (0) | TrackBacks (0)
本篇相关文章:

《网瘾战争》--看你妹 - 2010-01-24

UTF8 在线转换工具 - 2008-01-17

发现chm文件内容无法显示 - 2007-12-10

发表一个评论

关于这篇文章

这篇文章由2hei2010年4月 8日 15:50发布.

上一篇:4.1 愚人节恶搞之 kernel.org

下一篇:xml类型的配置文件包含特殊字符的处理

回到首页 或者查看归档文章

  • Powered by FeedBurner
  • Add to Google Reader or Homepage
  • Add to My AOL
  • Subscribe in NewsGator Online
  • del.icio.us/2heidel.icio.us/2hei
  • Subscribe to feed feeds