1. Generate a server-side certificate library (KeyStore Certificate library file) for Client Authentication Service-side authenticity
Keytool-genkey-v-alias key_server-keyalg rsa-keystore e:\server.keystore-dname "cn=d-f005227,ou=youku,o= ZHIBOHUDONG,L=BEIJING,ST=BEIJING,C=CN "-storepass aa123-keypass aa123-validity 36000
Issuer Information:
CN: Generally referred to as the site domain name (communicating net)
OU: Organizational unit name (organization unit)
O: Organization name (organization)
L: City or region (location)
ST: State or province
C: Two-letter country code (country)
2, generate the client certificate (PKCS12 file), for two-way authentication in the server to verify that the client request source is legitimate users
Keytool-genkey-v-alias key_client-keyalg rsa-storetype pkcs12-keystore e:\client.p12-dname "Cn=d-f005227,ou=youku,o =ZHIBOHUDONG,L=BEIJING,ST=BEIJING,C=CN "-storepass bb123-keypass bb123-validity 36000
3. Let the server trust the client certificate and export the client certificate as a CER file
Keytool-export-alias key_client-keystore e:\client.p12-storetype pkcs12-storepass bb123-rfc-file e:\client.cer
4. Import the client certificate (CER file) exported in step 3 into the server-side certificate Library in step 1 to complete the trust binding
Keytool-import-v-file E:\client.cer-keystore E:\server.keystore-storepass Aa123
5. Tomcat server configuration, support HTTPS secure connection (SSL bidirectional authentication, clientauth=true|false|want)
Open Tomcat_home\conf\server.xml, New in <service name= "Catalina" >:
<connector port= "4433" protocol= "http/1.1" sslenabled= "true" maxthreads= "" scheme= "https" secure= "true" ClientA Uth= "true" sslprotocol= "TLS" keystorefile= "E:/server.keystore" keystorepass= "Aa123" truststorefile= "E:/server.keys Tore "truststorepass=" Aa123 "/>
6, let the client import the certificate, in order to complete two-way authentication, normal access
Call E:/CLIENT.P12
7, export the server-side certificate, installed in the client (certificate store location: Trusted root certification authority), in order to establish a trust connection, to ensure that the client does not prompt the untrusted site (if the server-side certificate is issued by an authoritative certificate authority, you do not need to perform this step)
Keytool-export-alias key_server-keystore e:\server.keystore-storepass aa123-rfc-file e:\server.cercall e:/ Server.cer
8, start the server, access authentication
Input address: https://d-f005227:4433, cute Tom Kitten appeared, and the address bar appears in front of a green lock, OK, finish the call!
attached: when you turn on two-way SSL authentication (clientauth=true), use the Firefox browser to access the prompt
You will need to manually import the client certificate by following these steps:
The menu-------------------------------------to your certificate-- The import succeeds---OK--refreshes the page--
HTTPS Environment build configuration (server Tomcat-based)