生成证书的步骤

1.进入jdkbin目录

keytool -genkey -alias tomcat -keyalg RSA   命名证书的名字叫tomcat

 

2.将证书拷贝至tomcatbin目录

 

3.导出证书

keytool -export -alias tomcat -file tomcat.crt -keystore .keystore

 

4.导入证书的信息

keytool -export -alias tomcat -keystore .keystore -storepass  密钥库密码 -rfc -file tomcat.cer

5.tomcat的serverxml配置(秘钥库密码默认是changeit)

<Connector port="443" protocol="HTTP/1.1" SSLEnabled="true"

maxThreads="150" scheme="https" secure="true"
keystoreFile="bin/.keystore" keystorePass="秘钥库密码"     
clientAuth="false" sslProtocol="TLS" />