SSL in Tomcat
The following instructions will guide you through the CSR generation process on Tomcat. To learn more about CSRs and the importance of your private key, refer our Overview of Certificate Signing Request article. If you already generated the CSR and received your trusted SSL certificate, refer our SSL Installation Instructions and disregard the steps below.
1. Navigate to the Directory The Directory is where you will manage the certificate.
2. Enter key generation command Generate a keystore and private key by running the following command:
keytool -genkey -alias server -keyalg RSA -keysize 2048 -keystore your_domain_name.jks
3. Create the keystore Enter a keystore password.
Enter your Organization Information.
Enter y or yes when prompted only if all information is correct.
Enter your keystore password and press Enter.
Your keystore has been created in the current directory.
4. Run the CSR command From the newly created keystore, generate your CSR by running the following keytool command:
keytool -certreq -alias server -file csr.txt -keystore your_domain_name.jks
Enter your keystore password and press Enter.
Your CSR has been created in the current directory.
5. Generate the order Locate and open the newly created CSR in a text editor such as Notepad and copy all the text including:
-----BEGIN CERTIFICATE REQUEST-----
And
-----END CERTIFICATE REQUEST-----
Return to the Generation Form on our website and paste the entire CSR into the blank text box and continue with completing the generation process.
Upon generating your CSR, your order will enter the validation process with the issuing Certificate Authority (CA) and require the certificate requester to complete some form of validation depending on the certificate purchased. For information regarding the different levels of the validation process and how to satisfy the industry requirements, refer our validation articles.
After you complete the validation process and receive the trusted SSL Certificate from the issuing Certificate Authority (CA), proceed with the next step using our SSL Installation Instructions for Tomcat.
How to Install an SSL/TLS Certificate In Tomcat The following instructions will guide you through the SSL installation process on Tomcat. If you have more than one server or device, you will need to install the certificate on each server or device you need to secure. If you still have not generated your certificate and completed the validation process, refer our CSR Generation Instructions and disregard the steps below.
What You’ll Need
1. Your server certificate This is the certificate you received from the CA for your domain. You may have been sent this via email. If not, you can download it by visiting your Account Dashboard and clicking on your order.
2. Your intermediate certificates These files allow the devices connecting to your server to identify the issuing CA. There may be more than one of these certificates. If you got your certificate in a ZIP folder, it should also contain the Intermediate certificate(s), which is sometimes referred to as a CA Bundle. If not, download the appropriate CA Bundle for your certificate.
3. Your private key This file should be on your server, or in your possession if you generated your CSR from a free generator tool. On certain platforms, such as Microsoft IIS, the private key is not immediately visible to you but the server is keeping track of it.
Installation Instructions
1. Convert your certificate files Convert your certificate files from PEM (.cer or .crt) to PKCS#7 (.p7b) Format. You can easily do this on your own system by running below OpenSSL command.
openssl crl2pkcs7 -nocrl -certfile certificate.cer -out certificate.p7b - certfile CACert.cer
2. Access your Directory Go to the same Directory where you previously saved the keystore and Certificate Signing Request (CSR).
3. Run the Install command Install the certificate in the same keystore by running the following command:
keytool -import -trustcacerts -alias server -file your_file_name.p7b -keystore your_domain_name.jks
4. Check confirmation message You should receive this confirmation message: “Certificate reply was installed in keystore.”
5. Enter Y Enter Y or Yes when prompted to trust the certificate. Note: Your keystore now has the correct certificate files to use SSL/https on your Tomcat server.
6. Configure an SSL Connector Now, you need to configure an SSL connector which will enable the server to accept secure connections.
7. Open the .xml file Open the .xml file from your server in a text editor such as Notepad.
8. Locate your connector Locate the connector that you intend to use the new keystore to secure.
Note: Typically, the connector used has port 443 or 8443.
9. Uncomment the connector Uncomment the connector – if necessary – by removing the comment tags ().
10. Enter the keystore filename and password Enter the correct keystore filename and Password See our example below:
< Connector port=“443” maxHttpHeaderSize=“8192” maxThreads=“150” minSpareThreads=“25” maxSpareThreads=“75” enableLookups=“false” disableUploadTimeout=“true” acceptCount=“100” scheme=“https” secure=“true” SSLEnabled=“true” clientAuth=“false” sslProtocol=“TLS” keyAlias=“server” keystoreFile=“/home/user_name/your_domain_name.jks” keystorePass=“your_keystore_password” />
11. Save your changes Save all changes made to your .xml file.
12. Restart Tomcat Restart your Tomcat server to complete the SSL installation process.
Congratulations! You’ve successfully installed your SSL certificate! To check your work, visit the website in your browser at https://yourdomain.tld and view the certificate/site information to see if HTTPS/SSL is working properly. Remember, you may need to restart your server for changes to take effect.
To check your server’s configurations more thoroughly, use our SSL Checker Tool or contact our Customer Experience Department for additional assistance.