?
?
以命令行方式切换到目录%TOMCAT_HOME%,在command命令行输入如下命令(jdk1.4以上带的工具):? keytool -genkey -alias tomcat -keyalg RSA -keypass changeit -storepass changeit -keystore server.keystore -validity 3600 用户名输入域名,如localhost(开发或测试用)或hostname.domainname(用户拥有的域名),其它全部以 enter 跳过,最后确认,此时会在%TOMCAT_HOME%下生成server.keystore 文件。?
导入过程分2步,第一步是导出证书,第二步是导入到证书信任库,命令如下: keytool -export -trustcacerts -alias tomcat -file server.cer -keystore??server.keystore -storepass changeit keytool -import -trustcacerts -alias tomcat -file server.cer -keystore? %JAVA_HOME%/jre/lib/security/cacerts -storepass changeit 如果有提示,输入Y就可以了。 其他有用keytool命令(列出信任证书库中所有已有证书,删除库中某个证书): keytool -list -v -keystore D:/sdks/jdk1.5.0_11/jre/lib/security/cacerts keytool -delete -trustcacerts -alias tomcat? -keystore? D:/sdks/jdk1.5.0_11/jre/lib/security/cacerts -storepass changeit<Connector protocol="org.apache.coyote.http11.Http11NioProtocol" port="8443" minSpareThreads="5" maxSpareThreads="75" enableLookups="true" disableUploadTimeout="true" acceptCount="100" maxThreads="200" scheme="https" secure="true" SSLEnabled="true" clientAuth="false" sslProtocol="TLS" keystoreFile="D:/www/apache-tomcat-6.0.32/server.keystore" keystorePass="changeit"/>?
<login-config> <auth-method>CLIENT-CERT</auth-method> <realm-name>Client Cert Users-only Area</realm-name> </login-config> <security-constraint> <!-- Authorization setting for SSL --> <web-resource-collection > <web-resource-name >SSL</web-resource-name> <url-pattern>/*</url-pattern> </web-resource-collection> <user-data-constraint> <transport-guarantee>CONFIDENTIAL</transport-guarantee> </user-data-constraint> </security-constraint>?
?
?
?