Tomcat https and Tomcat https
1. Configure https one-way certificate authentication for Tomcat
Open tomcat's server. xml and find the <Connector port = "8443" node. The node should be commented out by default. uncomment and add the attribute:
KeystoreFile = "D: \ tomcat. jks"
Keystorepass= "123456"
The following describes how to create tomcat. jks:
Run the following commands at the Windows Command Prompt:
Cd % JAVA_HOME % \ bin
Keytool-genkeypair-keypass 123456-keyalg RSA-keystore D: \ tomcat. keystore-storepass 123456-dname "CN = localhost"
2. Configure https two-way certificate authentication for Tomcat
Open tomcat's server. xml and find the <Connector port = "8443" node. The node should be commented out by default. Cancel the comment,
Modify attributes:
ClientAuth = "true"
Add attributes:
KeystoreFile = "D: \ tomcat. jks"
Keystorepass= "123456"
TruststoreFile = "D: \ tomcat. jks"
TruststorePass = "123456"
The following describes how to create tomcat. jks:
Run the following commands at the Windows Command Prompt:
Cd % JAVA_HOME % \ bin
Keytool-genkeypair-alias tomcat-keypass 123456-keyalg RSA-keystore D: \ tomcat. jks-storepass 123456-dname "CN = localhost"
Keytool-genkeypair-alias mykey-keyalg RSA-storetype PKCS12-keystore D: \ mykey. p12-storepass 123456-dname "CN = demo"
Keytool-exportcert-alias mykey-keystore D: \ mykey. p12-storetype PKCS12-file D: \ mykey. cer-storepass 123456
Keytool-importcert-file D: \ mykey. cer-keystore D: \ tomcat. jks-storepass 123456
Enter the letter y to trust this certificate
Double-click D: \ mykey. p12 and the system prompts you to import the certificate to your computer.