To achieve mutual authentication Tomcat
SSL: Security Socket Layer Protocol
The public key and private key: for OpenSSL, which also includes the private key public key information. So, do not need a separate public key is generated.
Public key generation algorithm: The most popular and certificates related to RSA and DSA.
Description:
To achieve two-way SSL authentication, you must also configure the Web server certificates and client certificates, and the need for the server and the client is properly installed between the root certificate. Therefore, to configure a good two-way SSL, we need to have these things.
Now I am a little bit about the detailed steps of its total is divided into six major step:
First step: generate a self-signed CA certificate
A) Create CA private key
zhou @ ubuntu: ~ / ssl $ openssl genrsa-out ca / ca-key.pem 2048
genrsa mean that the generated private key rsa
-out parameter refers to the place where the private key generated
2048 this parameter in many other online documents which are written in 1024, I wrote 2048 in the openssl.org website inside to see.
As follows: The number 2048 is the size of the key, in bits. Today, 2048 or higher is recommended for RSA keys, as fewer amount of bits is consider insecure or to be insecure pretty soon.
B) with the CA private key is generated CA certificate request
zhou @ ubuntu: ~ / ssl $ openssl req-new-out ca / ca-req.csr-key ca / ca-key.pem
req means that CA generated certificate request
-new estimate is that used to generate a new certificate request
-out that where the certificate request file into the
-key, said private key with which to generate a certificate request
Type enter, the system will ask you to fill in the following range of information:
You are about to be asked to enter information that will be incorporated into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank
For some fields there will be a default value, If you enter '.', The field will be left blank.
-----
Country Name (2 letter code) [AU]: cn / / Which country
State or Province Name (full name) [Some-State]: zhejiang / / Which provinces
Locality Name (eg, city) []: hangzhou / / which city
Organization Name (eg, company) [Internet Widgits Pty Ltd]: lianlian / / which company
Organizational Unit Name (eg, section) []: CPT / / Department Name
Common Name (eg, YOUR name) []: zhizhang / / your name
Email Address []: zhouzz@lianlian.com / / your e-mail
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: changeit / / password
An optional company name []: lianlian group / / What's the name the company can also be
Theoretically speaking, generated by the CA certificate request body, it will be issuing a certificate issued by the CA, we are here, from the self-signed certificate instead.
C) with the CA private key and CA certificate request is generated self-signed CA certificate
zhou @ ubuntu: ~ / ssl $ openssl x509-req-in ca / ca-req.csr-out ca / ca-cert.pem-signkey ca / ca-key.pem-days 1095
Type enter, the system prompts signature Ok:
Signature ok
subject = / C = cn / ST = zhejiang / L = hangzhou / O = lianlian / OU = CPT / CN = zhizhang / emailAddress = zhouzz@lianlian.com
Getting Private key
Second step: generate the server certificate
A) Create Server private key
zhou @ ubuntu: ~ / ssl $ openssl genrsa-out server / server-key.pem 2048
B) with the Server certificate request private key is generated Server
zhou @ ubuntu: ~ / ssl $ openssl req-new-out server / server-req.csr-key server / server-key.pem
Type enter, the system will ask you to fill in the following range of information:
You are about to be asked to enter information that will be incorporated into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value, If you enter '.', The field will be left blank.
-----
Country Name (2 letter code) [AU]: cn
State or Province Name (full name) [Some-State]: zhejiang
Locality Name (eg, city) []: hangzhou
Organization Name (eg, company) [Internet Widgits Pty Ltd]: lianlian
Organizational Unit Name (eg, section) []: CPT
Common Name (eg, YOUR name) []: localhost / / here it should be not the same as with the CA certificate should be the domain name server or the IP
Email Address []: zhouzz@lianlian.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: changeit
An optional company name []: lianlian group
C) with the Server private key, Server certificate request, CA private key and CA certificate self-signed certificate is generated Server
zhou @ ubuntu: ~ / ssl $ openssl x509-req-in server / server-req.csr-out server / server-cert.pem-signkey server / server-key.pem-CA ca / ca-cert.pem-CAkey ca / ca-key.pem-CAcreateserial-days 1095
The system returns Signature OK
Signature ok
subject = / C = cn / ST = zhejiang / L = hangzhou / O = lianlian / OU = CPT / CN = localhost / emailAddress = zhouzz@lianlian.com
Getting Private key
Getting CA Private Key
D) Server to export the certificate into the browser supports. P12 format
zhou @ ubuntu: ~ / ssl $ openssl pkcs12-export-clcerts-in server / server-cert.pem-inkey server / server-key.pem-out server/server.p12
Enter Export Password:
Verifying - Enter Export Password:
The third step: Generating client certificates
A) Creating Client private key
zhou @ ubuntu: ~ / ssl $ openssl genrsa-out client / client-key.pem 2048
Typing carriage return:
Generating RSA private key, 2048 bit long modulus
.................................................. ...+++
..............+++
e is 65537 (0x10001)
B) the private key is generated using Client Certificate Request Client
zhou @ ubuntu: ~ / ssl $ openssl req-new-out client / client-req.csr-key client / client-key.pem
You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', The field will be left blank.
-----
Country Name (2 letter code) [AU]: cn
State or Province Name (full name) [Some-State]: zhejiang
Locality Name (eg, city) []: hangzhou
Organization Name (eg, company) [Internet Widgits Pty Ltd]: lianlian
Organizational Unit Name (eg, section) []: CPT
Common Name (eg, YOUR name) []: clienthost / / Here I am not quite clear about the details should write what I write client-server address.
Email Address []: zhouzz@lianlian.com
Please enter the following 'extra' attributes
to be sent with your certificate request
A challenge password []: changeit
An optional company name []: lianlian group
C) with the Client private key, Client certificate request, CA private key and CA certificate self-signed certificate is generated Client
zhou @ ubuntu: ~ / ssl $ openssl x509-req-in client / client-req.csr-out client / client-cert.pem-signkey client / client-key.pem-CA ca / ca-cert.pem-CAkey ca / ca-key.pem-CAcreateserial-days 1095
The system returns Signature OK
Signature ok
subject = / C = cn / ST = zhejiang / L = hangzhou / O = lianlian / OU = CPT / CN = clienthost / emailAddress = zhouzz@lianlian.com
Getting Private key
Getting CA Private Key
D) to export the certificate into the Client browser support. P12 format
zhou @ ubuntu: ~ / ssl $ openssl pkcs12-export-clcerts-in client / client-cert.pem-inkey client / client-key.pem-out client/client.p12
Type the command, the system will be asked to lose two password: changeit
Enter Export Password:
Verifying - Enter Export Password:
The fourth step: According to the CA certificate is generated truststore JKS file (I guess the meaning of this abbreviation may be Java Key Store)
A) generated truststore file
zhou @ ubuntu: ~ / ssl $ keytool-keystore jks / truststore.jks-keypass changeit-storepass lianlian.com-alias ca-import-trustcacerts-file ca / ca-cert.pem
After typing thing, indicating whether the information in this certificate, enter yes, then the generated keystore success.
Owner: EMAILADDRESS = zhouzz@lianlian.com, CN = zhizhang, OU = CPT, O = lianlian, L = hangzhou, ST = zhejiang, C = cn
Issuer: EMAILADDRESS = zhouzz@lianlian.com, CN = zhizhang, OU = CPT, O = lianlian, L = hangzhou, ST = zhejiang, C = cn
Serial number: c14463d09ba37b39
Valid from: Fri Jan 29 03:33:25 PST 2010 until: Mon Jan 28 03:33:25 PST 2013
Certificate fingerprints:
MD5: D6: 4A: 7E: 89:59:27:88:63: B5: 28:2 C: 38: EB: 44: B5: B6
SHA1: BA: 26:16: C4: 4B: 1C: 0B: 65: F2: CB: CD: DB: DF: E1: D1: C3: 70:55:0 D: 2A
Signature algorithm name: SHA1withRSA
Version: 1
Trust this certificate? [No]: yes
Certificate was added to keystore
5th step: Configure Tomcat SSL
tomcat6.0 configuration:
<Connector port = "8443" protocol = "HTTP/1.1" SSLEnabled = "true"
maxThreads = "150" scheme = "https" secure = "true"
clientAuth = "true" sslProtocol = "TLS"
keystoreFile = "D: \ \ app \ \ ssl \ \ ssl \ \ server \ \ server.p12" keystorePass = "changeit" keystoreType = "PKCS12"
truststoreFile = "D: \ \ app \ \ ssl \ \ ssl \ \ jks \ \ truststore.jks" truststorePass = "lianlian.com" truststoreType = "JKS" />
Sixth step: Test Tomat SSL
ca-cert.pem imported into the Trusted Root Certificate Authorities, client.p12 import to individuals
Access to your application https: / / ip: 8443 /, if configured correctly, you will appear a request for Digital Certificate dialog box.
Related Posts of To achieve mutual authentication Tomcat
-
Hibernate Configuration Guide - the primary key generation strategy
Life and death process error, I After half a day , tracking in the end, until suddenly, hibernate analytic sql statement at a time when one of the put right, as a database the right connection ( "Reserved Words"), Alas, this keyword should ...
-
hibernate-memcached - memcached at Hibernate to use as a secondary sub --
http://www.blogjava.net/xmatthew/archive/2008/08/20/223293.html Today use the Internet to see a two memcached distributed cache as Hibernate, feeling quite interesting in that try, and feel good, they recommend to everyone to look at. Official Websit ...
-
At Windows on the installation of Redmine
10. libiconv 1.9.1: ftp://mirrors.kernel.org/gnu/libiconv/libiconv-1.9.1.bin.woe32.zip. Take into account when running rake Installation and Configuration 1. Ruby 1.8.7 will unzip the installation package to a directory (for example: C: \ ruby-1.8.7) ...
-
Hibernate study the next day
hibernate basic mapping Entity class --- Table Entity class property --- ordinary table field <class> Using tags mapped database table through <PROPERTY> property tag will be mapped into a common table field Refers to the so-called common ...
-
spring + hibernate + struts themselves summed up approach.
In fact very simple and only required two steps: 1. In the web.xml file add the following code to load the spring configuration file. 2. In order to enable the Action to be Bean, Writing a BaseAction categories, in order to obtain the desired Bean. B ...
-
At the installation of Ubuntu 8.10 on Rails
With aptitude and gem, at the installation of ubuntu on Rails is not a difficult thing, but the actual installation perhaps encounter problems, such as the omission of certain library, and so on must be an updated version. If an error occurs the go c ...
-
At compile ruby under ubuntu
Compiler environment nothing to add to that, in fact, do not require ruby basically Quote sudo apt-get install build-essential On the same subject. Attention should be paid to the general ssl are required and the readline library. Quote sudo apt-get ...
-
Study Notes Hibernate three (cache)
Divided into two levels: session level (level cache), sessionFactory secondary cache session cache, we must at the same session, if the session closed, the cache is lost. Cache level for relatively short periods. save, update, saveOrUpdate, load, get ...
-
Hibernate primary key strategy-sequence
Today, the use of hibernate in the company encountered a troublesome problem, the use of hibernate when the primary key generation strategy set sequence, but always reported in the implementation could not get next sequence value of the error, then o ...
-
Hibernate.cfg.xml configuration file (including the primary key generation strategy Introduction)
Hibernate.cfg.xml configuration file: <? xml version = "1.0" encoding = "utf-8"?> <! DOCTYPE hibernate-configuration PUBLIC "- / / Hibernate / Hibernate Configuration DTD / / EN" "hibernate-configuration-2.0.dtd













Responses to “To achieve mutual authentication Tomcat”