Tomcat6配置使用SSL双向认证(下)
时间:2009-03-09 来源:h0ng123
C:\OpenSSL\apps\root>keytool -import -v -trustcacerts -storepass password -alias root -file root-cert.pem -keystore root.jks 5)配置tomcat ssl,修改conf/server.xml。tomcat6中多了SSLEnabled="true"属性。
keystorefile, truststorefile设置为你正确的相关路径
<connector secure="true" scheme="https" protocol="HTTP/1.1" port="8443"
sslenabled="true" maxhttpheadersize="8192" maxthreads="150"
minsparethreads="25" maxsparethreads="75" enablelookups="false"
disableuploadtimeout="true" acceptcount="100" sslprotocol="TLS"
clientauth="true" keystorefile="d:/path/bin/x509/server.p12"
keystoretype="PKCS12" keystorepass="123456" truststorefile="d:/path/bin/x509/root.jks"
truststoretype="JKS" truststorepass="123456"/> 6.将root.p12,client.p12分别导入到IE中去(打开IE->;Internet选项->内容->证书)。
root.p12导入至受信任的根证书颁发机构,client.p12导入至个人 7)访问你的应用http://ip:8443,如果配置正确的话会出现请求你数字证书的对话框。 8)在jsp中取得符合x.509格式的证书
<%
//获得certificate chain
X509Certificate[] ca=(X509Certificate[])request.getAttribute("javax.servlet.request.X509Certificate");
if(ca==null)
{
out.println("No cert info!");
} else {
String serial=ca[0].getSerialNumber().toString();
String DN=ca[0].getSubjectDN().toString();
}
%>
相关阅读 更多 +
排行榜 更多 +