1. One-way authentication is that the transmitted data is encrypted, but the source of the client is not verified
2. Two-way authentication, if the client browser does not import the client certificate, is not able to access the Web system, cannot find the address
If it's just encryption, one-way.
Two-way authentication is used if the person who wants to use the system cannot access the system without a certificate.
First step: Generate a certificate for the server
Using Keytool to generate a certificate for Tomcat, assuming the domain name of the target machine is "localhost", the KeyStore file is stored in "E:\\tomcat.keystore" with a password of "123456" and generated using the following command:
Keytool-genkey-alias tomcat-keyalg rsa-keysize 2048-keystore e:\tomcat.keystore-storepass 123456-keypass 123456
As follows:
Second step: Because it is one-way authentication, there is no need to generate the client's certificate, directly into the directory: E:\apache-tomcat-6.0.41\conf configuration server.xml file
Modify the configuration file as follows.
-
<!-- <connector port= "8443" protocol= "http/1.1" sslenabled= "true" maxthreads= "all Scheme=" "https" Secure= "true" clientauth= "false" sslprotocol= "TLS"/>
<!--post-change profile contents -
<ConnectorPort= "8443"Protocol= "http/1.1"sslenabled= "true"MaxThreads= "Max"Scheme= "https"Secure= "true"ClientAuth= "false"Sslprotocol= "TLS"Keystorefile= "E:\\tomcat.keystore"Keystorepass= "123456" />
Some of the attribute parameters in the <Connector> configuration are shown in the following table:
| Properties |
Description |
| ClientAuth |
If set to True, indicates that Tomcat requires all SSL clients to present a security certificate to authenticate the SSL client |
| Keystorefile |
Specifies the location of the KeyStore file, either specifying an absolute path, or specifying a relative path relative to the <CATALINA_HOME> (Tomcat installation directory) environment variable. If this item is not set, by default, Tomcat will read the file named ". KeyStore" from the user directory of the current operating system user. |
| Keystorepass |
Specifies the password for the KeyStore, and by default, Tomcat uses "Changeit" as the default password if it is not set. |
| Sslprotocol |
Specifies the encryption/decryption protocol used by the socket (socket) and the default value is TLS, which should not be modified by the user. |
| Ciphers |
Specifies the list of passwords available for the socket for encryption, separated by commas (,) between multiple passwords. If this item is not set, by default, the socket can use any one of the available passwords. |
Step Three: Verify
Access address https://localhost:8443/See the following effect, indicating that the validation was successful.
After validation succeeds, you can view the details of the certificate.
Tomcat configuration HTTPS (one-way authentication)