tomcat配置https

参考帖子

http://lixor.iteye.com/blog/1532655

http://blog.csdn.net/u010448471/article/details/50966636

http://blog.csdn.net/a351945755/article/details/22727259

主要命令,按照顺序执行

为tomcat7生成验证客户端证书

keytool -genkey -alias client -keyalg RSA -storetype PKCS12 -keystore client.key.p12 -validity 36500

keytool -export -keystore client.key.p12 -storetype PKCS12 -alias client -file client.key.cer

keytool -import -file client.key.cer -keystore tomcat.keystore -v

生成验证服务器端证书(根证书)

keytool -genkey -alias tomcat -keyalg RSA -keystore d:/keys/tomcat.keystore -validity 36500

根证书

keytool -export -file d:/keys/server.crt -alias tomcat -keystore d:/keys/tomcat.keystore

如果是tomcat7,则不需要执行以下命令

keytool -importkeystore -srckeystore D:/keys/tomcat.keystore -destkeystore D:/keys/intermediate.p12 -deststoretype PKCS12

openssl pkcs12 -in d:keysintermediate.p12 -out d:keysserver.key -nodes

用以上命令产生:

server.crt 以及server.key

tomcat6.0貌似不支持验证客户端是否合法。

验证服务器端端配置:tomcat6.0

tomcat 的confserver.xml文件中激活以下语句 ,

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true" 
SSLCertificateFile="D:/keys/server.crt"
SSLCertificateKeyFile="D:/keys/server.key" 
clientAuth="false" sslProtocol="TLS" />

双验证客户端以及服务器端端配置:tomcat7.0

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true" 
keystoreFile="D:/keys/tomcat.keystore" keystorePass="123456" 
truststoreFile="D:/keys/tomcat.keystore" truststorePass="123456"
clientAuth="true" sslProtocol="TLS" />

然后重启tomcat

完成验证客户端的配置双击client.key.p12 客户端密钥库安装到浏览器,就实现了服务器对客户端的验证,一般位置放置在个人

完成验证服务器端的配置把server.crt证书导入到 【受信任的根证书颁发机构本地计算机】 chrome->setting->高级设置->https/ssl->证书管理

tomcat6.0的效果图

 tomcat7下客户端没有证书验证客户端是否合法的截图

tomcat7下选择客户端验证证书的截图

tomcat7 验证后正常进入后的效果图

申请dv证书网址 http://www.wo-sign.com/DVSSL/DV_KuaiSSL.htm

http://blog.csdn.net/yizhou35/article/details/12372623

http://www.startssl.com/ 免费申请ssl证书

http://jingyan.baidu.com/article/ce43664919d1383773afd39f.html?qq-pf-to=pcqq.group

 证书的认证是按照证书链来实现的。程序无条件信任根证书,然后根证书机构会颁发一个以根证书私钥签名的证书,程序就可以用它信任的根证书去校验这个证书的签名,以达到认证的目的,往下类推。
所以12306和支付宝需要导入他们自己的根证书,才能让他们颁发的证书被浏览器信任。
浏览器中默认导入了一些全世界公认的根证书颁发机构的证书。 
原文地址:https://www.cnblogs.com/coolyylu/p/6425897.html