posts - 1,  comments - 25,  trackbacks - 0
1. Generate KeyStore


set SERVER_DN="CN=Server, OU=ec, O=ec, L=nanchang, S=jiangxi, C=CN"
set CLIENT_DN="CN=Client, OU=ec, O=ec, L=nanchang, S=jiangxi, C=CN"
set KS_PASS=-storepass PASSWORDHERE
set KEYINFO=-keyalg RSA
keytool -genkey -alias Server -dname %SERVER_DN% %KS_PASS% -keystore server.keystore %KEYINFO% -keypass strongit
keytool -export -alias Server -file test_axis.cer %KS_PASS% -keystore server.keystore
keytool -import -file test_axis.cer %KS_PASS% -keystore client.truststore -alias serverkey -noprompt
keytool -genkey -alias Client -dname %CLIENT_DN% %KS_PASS% -keystore client.keystore %KEYINFO% -keypass strongit
keytool -export -alias Client -file test_axis.cer %KS_PASS% -keystore client.keystore
keytool -import -file test_axis.cer %KS_PASS% -keystore server.truststore -alias clientkey -noprompt
2. Modify server.xml

<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
               maxThreads="150" scheme="https" secure="true"
               clientAuth="false" keystoreFile="D:\test\server.keystore" keystorePass="PASSWORDHERE"
                 truststoreFile="D:\test\server.truststore" truststorePass="PASSWORDHERE" sslProtocol="TLS" />


3. add below code into your invoke code

System.setProperty("javax.net.ssl.keyStore",
"D:\\test\\client.keystore");
System.setProperty("javax.net.ssl.keyStorePassword", "PASSWORDHERE");
System.setProperty("javax.net.ssl.trustStore",
"D:\\test\\client.truststore");
System.setProperty("javax.net.ssl.trustStorePassword",
"PASSWORDHERE");
URL url = new URL("https://localhost:8443/TOMCAT6/services/GetName");
posted on 2011-05-17 21:39 Daniel 阅读(320) 评论(0)  编辑  收藏 所属分类: WebService

只有注册用户登录后才能发表评论。


网站导航:
 
<2024年11月>
272829303112
3456789
10111213141516
17181920212223
24252627282930
1234567

常用链接

留言簿(3)

随笔档案

文章分类

文章档案

相册

搜索

  •  

最新评论