These days I have a very good experience on installing a CA-signed certificate to our Faculty server. I found that it is much more complicated than a self-signed certificate that I used before. There are lots of formats, types and others things that arouse my concerns during the installation. Let’s walk through some of these.
Before my work, the Faculty of mine bought a certificate from a CA named GeoTrust (which also refers to Equifax). The certificate from this CA has already been installed in more than 90% browsers nowadays, so it is quite a common one compared with those like Verisign and Thawte. That certificate bought is used on one Apache HTTP Server, and my work is to install it to Apache Tomcat on the same machine.
For the usage in Apache HTTP Server, there are two files, which are named like mycert.crt and mykey.key. These two files are the public key and private key respectively. I don’t know what format they are, but I can’t use either of them as the keystore provided to tomcat. Tomcat will throw javax.net.ssl.SSLException and saying that: No available certificate or key crresponds to the SSL cipher suites which are enabled.
After that, I sent an email to the support and asked for help. The guy there provide me a way to go, which is to convert the certificate to the format that Tomcat can use. The procedure is like this:
1. Run the following command to create a keystore named “mycert.p12″ with an alias “tomcat” inside (The alias must be “tomcat”, as it is recognized by Apache Tomcat)
openssl pkcs12 -export -in mycert.crt -inkey mykey.key -out mycert.p12 -name tomcat -CAfile GeoTrustRootCA.cer -caname root -chain
Where GeoTrustRootCA.cer’ is the GeoTrust Root CA available for download here: http://www.geocerts.com/support/roots.php , ‘mycert.crt’ is your current ssl certificate, ‘mykey.key’ is your current private key.
For the GeoTrust Root CA, either Base-64 and DER format can be used. There is no difference after all the works.
2. After running the command, it will ask you for the password, typed in “changeit”. Oh, why “changeit”? Actually, the password is up to you, but it is used by Tomcat to access this keystore. If you used other password, you have to explicitly provided in the Tomcat configuration, which we will talk in Step 4.
3. The keystore named “mycert.p12″ is created, it is a X.509 certificate with PKCS#12 format. The format is different from the self-signed certificate created by “keytool”, which is JKS (Java KeyStore)
4. Configure the Tomcat server to switch on secure connection as usual with some additional settings as below:
You then have to specify Tomcat that the keystore is in pkcs12 format by inserting keystoreType=”pkcs12″ in the ssl configuration, also the keystore location pointing to where mycert.p12 is located.
After configuring this, the SSL should be ready using this CA-signed certificate.
Remarks:
There are still some questions that I didn’t solve, which are all related to the command used in Step 1. Some of the options like “-caname” and “-chain” are still unknown to me. Perhaps, someone can give me an answer.
Reference:
http://tomcat.apache.org/tomcat-5.5-doc/ssl-howto.html
http://www.geocerts.com/support/install/install_tomcat.php








