https连接webservice实现流程.docx
《https连接webservice实现流程.docx》由会员分享,可在线阅读,更多相关《https连接webservice实现流程.docx(10页珍藏版)》请在冰豆网上搜索。
![https连接webservice实现流程.docx](https://file1.bdocx.com/fileroot1/2023-1/28/2558510d-a6e0-49c4-ab8b-49f8fd26a3ee/2558510d-a6e0-49c4-ab8b-49f8fd26a3ee1.gif)
https连接webservice实现流程
目录
1.文档管理:
3
1.1.修订记录3
2.环境4
3.使用jdk的keytool生产证书4
3.1生产服务器证书4
3.2安装客服端证书.....................................................................................................5
3.3在客服端安装服务端证书......................................................................................8
3.4检查安装结构.......................................................................................................11
4.服务端与客服端配置
4.1tomcat配置..........................................................................................................12
4.2axis2.xml配置......................................................................................................12
4.3添加客服端代码....................................................................................................13
5.jks格式证书部署
5.1导出客服端公钥证书.............................................................................................13
5.2安装客服端公钥证书.............................................................................................13
'
5.3配置tomcat服务...................................................................................................13
1.环境
●WIN7+TOMCAT7+JDK1.7
2.使用jdk的keytool生产证书
3.1生产服务器证书
3.11开始—运行—cmd—在dos窗口执行下执行命令:
keytool-genkey-v-aliastomcat-keyalgRSA-keystoreD:
/SSL/server/tomcat.keystore-dname"CN=localhost,OU=zlj,O=zlj,L=Peking,ST=Peking,C=CN"-validity3650-storepass123456-keypass123456
说明:
keytool是JDK提供的证书生成工具,所有参数的用法参见keytool–help
-genkey创建新证书
-v详细信息
-aliastomcat以”tomcat”作为该证书的别名。
这里可以根据需要修改
-keyalgRSA指定算法
-keystoreD:
/SSL/server/tomcat.keystore保存路径及文件名
-dname"CN=127.0.0.1,OU=zlj,O=zlj,L=Peking,ST=Peking,C=CN"证书发行
者身份,这里的CN要与发布后的访问域名一致。
但由于这里是自签证书,如果在浏览器访问,仍然会有警告提示。
真正场景中建议申请CA机构(wosign)签发的SSL证书更安全。
-validity3650证书有效期,单位为天
-storepass123456证书的存取密码
-keypass123456证书的私钥
3.12生产客服端证书:
执行命令:
keytool-genkey-v-aliasclient-keyalgRSA-storetypePKCS12-keystoreD:
/SSL/client/client.p12-dname"CN=localhost,OU=zlj,O=zlj,L=bj,ST=bj,C=CN"-validity3650-storepass123456-keypass123456
3.13导出客服端证书:
执行命令:
keytool-export-aliasclient-keystoreD:
/SSL/client/client.p12-storetypePKCS12-storepass123456-rfc-fileD:
/SSL/client/client.cer
3.14把客服端证书加入服务端证书列表
执行命令:
keytool-import-liasclient-v-fileD:
/SSL/client/client.cer-keystoreD:
/SSL/server/tomcat.keystore‐storepass123456
3.15导出服务端证书:
执行命令:
keytool-export-aliastomcat-keystoreD:
/SSL/server/tomcat.keystore-storepass123456-rfc-fileD:
/SSL/server/tomcat.cer
3.16生成客服端信任列表:
执行命令:
keytool-import-fileD:
/SSL/server/tomcat.cer-storepasszljzlj-keystoreD:
/SSL/client/client.truststore-aliastomcat-noprompt
3.2安装客服端证书:
3.21双击客服端证书client.p12文件,导入证书过程如下:
3.3在客服端安装服务器证书:
3.31双击tomcat.cer按照提示安装证书,将证书填到“受信任的根证书颁发机构”
3.4检查安装结构:
3.41IE->Internet选项->内容->证书:
3.服务器与客服端配置
4.1tomcat配置:
maxThreads="150"scheme="https"secure="true"clientAuth="true"
sslProtocol="TLS"keystoreFile="D:
/SSL/server/tomcat.keystore"
keystorePass="123456"truststoreFile="D:
/SSL/server/tomcat.keystore"
truststorePass="123456"/>
4.2axis2.xml配置:
4.3添加客服端代码:
System.setProperty(".ssl.trustStore","D:
/SSL/client/client.truststore");
System.setProperty(".ssl.trustStorePassword","123456");
System.setProperty(".ssl.keyStoreType","PKCS12");
System.setProperty(".ssl.keyStore","D:
/SSL/client/client.p12");
System.setProperty(".ssl.keyStorePassword","123456");
Stringurl="https:
//localhost:
8443/ThirdWebService/services/thirdInfowebService";
4.Jks格式证书部署
5.1导出客服端公钥证书
keytool-export-alias1-keystoreD:
/SSL/server/.jks-storepassHopsonlife123-rfc-fileD:
/SSL/server/aihsh.cer
5.2安装客服端公钥证书,步骤如3.2
5.3配置tomcat服务,步骤4.1