1. Build Server site Certificate 1) Generate key Warehouse
Enter the bin directory of the JDK, such as: D:\jdk1.6.0_16\bin
Perform:
D:\jdk1.6.0_16\bin\keytool-genkey-v-alias tomcat-keyalg rsa-keystore D:\server.keystore-validity 36500
(A brief description of the parameter: "D:\server.keystore" means to save the Certificate warehouse file path, the certificate warehouse file name is Server.keystore; "-validity 36500" means the certificate validity period, 36500 means 100 years, The default is 90 days "Tomcat" is the custom certificate name, and the default is the same as the warehouse file name)
Fill in the necessary parameters at the command line:
- Enter the KeyStore password: a string greater than 6 characters (for example: 123456) is required here.
- "What is your first and last name?" "This is a required field and must be the domain name or IP of the Tomcat deployment host, otherwise the browser will pop up a warning window prompting the user certificate to not match the domain in which it resides." When you do the development test locally, you should fill in "localhost".
- What is the name of your organizational unit? "," What is your organization name? "," What is your city or region name? "," What is the name of your state or province? "," What is the two-letter country code for this unit? "Can be filled in as needed or can not fill in the direct return, the system asked" correct? ", enter the letter" Y "with the keyboard if required, otherwise enter" n "to re-fill the information.
- Enter <tomcat> master password, this is more important, will be used in the Tomcat configuration file, the recommended input and KeyStore password consistent, set other password can also, after completing the above input, the direct return to the location you defined in the second step to find the generated file.
2) Generate a certificate signing request
Perform:
D:\jdk1.6.0_16\bin\keytool-certreq-alias Tomcat-keystore D:\server.keystore-file D:\tomcat.txt
(You can also not export the signing request, the server certificate is a self-signed certificate, if you do not export the signature request, 3), 4), 5) do not need to operate)
3) Signing the certificate signing request
Send the generated Tomcat.txt certificate signing request to the CA server and generate the Tomcat.cer
4) Import CA certificate to KeyStore
Perform:
D:\jdk1.6.0_16\bin\keytool-import-v-alias ca-file D:\CTJ.cer-keystore d:\server.keystore
Follow the prompts to enter the KeyStore password, you can import the success (use Keytool-list view)
5) Import the CA signed certificate
Put the generated tomcat.cer in 3) to the specified path
Perform:
D:\jdk1.6.0_16\bin\keytool-import-v-trustcacerts-alias tomcat-file D:\tomcat.cer-keystore d:\server.keystore
2. Issue client certificate (required for two-way authentication)
1) using the CA server to issue client certificates (CLIENT.PFX)
2) Import the client certificate into the local IE
Double-click Client.pfx, and follow the steps to install the client certificate
3) Import the CA certificate into the local IE
Follow the steps to install the CA certificate
4) Import the CA certificate into the KeyStore of 1 steps
3. Configuring the Tomcat Server
1) Enter the tomcat\conf\ directory, open Server.xml, find connector port= "8443" configuration section, modified as follows:
<connector port= "8443" protocol= "http/1.1"
Sslenabled= "true" maxthreads= "scheme=" "https"
Secure= "true" Clientauth= "true" sslprotocol= "TLS"
Keystorefile= "D:/server.keystore" keystorepass= "123456"
Truststorefile= "D:/server.keystore" truststorepass= "123456"/>
If it is a one-way authentication, set ClientAuth = "false".
2) Locate the connector port= "8080" configuration segment and modify it as follows:
<connector port= "protocol=" http/1.1 "
connectiontimeout= "20000" redirectport= "8443"/>
(redirect port number)
HTTPS service configuration is complete.
Personal summary, if there is inaccurate description of the place, hope advice.
Tomcat Build HTTPS Service