Record the learning process:
Environment: jdk6 win7 tomcat6.35
1. Create a certificate
Java code
keytool -genkey -alias tomcat -keypass tomcat -keyalg RSA -keystore tomcat.keystore
The picture on the keystore:
ps: The keystore password must be the same as the -keypass password
2. Export certificate
Java code
keytool -export -file tomcat.crt -alias tomcat -keypass tomcat -keystore tomcat.keystore
Figure: 3. Import certificate Java code
for client JVM keytool -import -file E:\keys\tomcat.crt -keypass tomcat -alias tomcat -keystore "cacerts" Note: The password for the keystore here must be entered: changeit, otherwise an error will be reported . Figure : ps: The reason for switching the path here is that there is a space in the Program Files directory, and an error will be reported . 4. Apply the certificate to the web container - Tomcat Open the conf/server.xml file in the tomcat directory, open the comment code in lines 83 and 87, and set keystoreFile and keystorePass. The modification results are as follows: Xml code
<Connector port="8443" protocol="HTTP/1.1" SSLEnabled="true"
maxThreads="150" scheme="https" secure="true"
clientAuth="false" sslProtocol="TLS" keystoreFile="E:/ keys/tomcat.keystore" keystorePass="tomcat"/>
Start tomcat, visit https://localhost:8443/ and this page appears indicating success
Reprinted from: http://576604498.iteye.com/blog/1838145
jdk tomcat keytool generates and configures https certificates
Guess you like
Origin http://10.200.1.11:23101/article/api/json?id=327015144&siteId=291194637
Recommended
Ranking