.1 确认存放keystore文件的位置(比如:D:\Tomcat\GMAE3.0Tomcat)
.2 在cmd中进入%JAVA_HOME%\bin目录下,执行以下命令:
keytool -genkey -alias tomcat -keyalg RSA -keystore d:\Tomcat\GMAE3.0Tomcat\tomcat.keystore
执行过程会提示输入密码,这个密码需要记录在server.xml中的Connector中,第3步有说明
.3 修改tomcat中文件conf/server.xml
<Connector port="8060" protocol="HTTP/1.1" connectionTimeout="20000" redirectPort="8063"
SSLEnabled="true" maxThreads="150" scheme="https" secure="true" clientAuth="false"
sslProtocol="TLS" keystoreFile="D:\Tomcat\GMAE3.0Tomcat\tomcat.keystore"
keystorePass="123456"/>
.4 在tomcat\conf\web.xml中的</welcome-file-list>后面加上这样一段:
<login-config>
<!-- Authorization setting for SSL -->
<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>