`
luckliu521
  • 浏览: 252942 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

如何用jdk的keytool制作ssl证书

 
阅读更多
C=CN,OU=IT,O=YIXIUWANG,ST=BEIJING,C=CN,L=HD,CN=192.168.1.122,emailAddress=test@test.com
服务器证书
keytool -genkeypair -v -alias tomcat -keyalg RSA -validity 730 -keystore c:\ca\tomcat.keystore -dname "C=xx,OU=xx,O=xx,ST=BEIJING,C=CN,L=HD,CN=192.168.1.122,emailAddress=test@test.com" -storepass 1234 -keypass 1234
客户端证书
keytool -genkeypair -v -alias client -keyalg RSA -storetype PKCS12 -validity 730 -keystore c:\ca\client.p12 -dname "CN=client,OU=IT,O=xxx,L=ANY,ST=bj,C=CN" -storepass 1234 -keypass 1234
让服务器信任客户端证书
keytool -exportcert -alias client -keystore c:\ca\client.p12 -storetype PKCS12 -storepass 1234 -rfc -file c:\ca\cacert.cer
将该文件导入服务器的证书库,添加为一个信任证书
keytool -importcert -v -file c:\ca\cacert.cer -keystore c:\ca\tomcat.keystore -storepass 1234
查看服务器证书库,看到服务器证书和
keytool -list -v -keystore  c:\ca\tomcat.keystore -storepass 1234
将c:\ca\tomcat.keystore拷贝到C:\Tomcat6.0

    <Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true" 
               clientAuth="true" sslProtocol="TLS"
               keystoreFile="tomcat.keystore" keystorePass="1234"
               truststoreFile="tomcat.keystore" truststorePass="1234"/>
单双向修改clientAuth就可以了,可制作bat shell脚本 注意linux下“\”和windows下“/”的区别
本文出自 “丁宁的博客” 博客,请务必保留此出处http://dingning51cto.blog.51cto.com/1797315/502635
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics