SSL Installation: Jetty Java HTTPS Servlet Web Server
Make sure you have all the following files saved before proceeding:
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.
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.
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.
Convert your certificate files from PEM (.cer or .crt) to PKCS#7 (.p7b) Format, find instructions here: Converting a PFX file to PEM, SPC, and PVK files
Select PEM as your Current type.
Select P7B as your Change for.
Upload Your Server Certificate.
Upload Root CA Certificate.
Note: This file is usually pre-installed on your server or device. You can always install it again to ensure the correct certificate chain is built.
Upload Your Intermediate Certificates.
Note: If you have two intermediate files, upload the second file as the Root CA Certificate. This will allow you to still build the correct certificate chain since the Root should be pre-installed on your server or device.
Click Convert and Save on your server or device.
Add the certificates to your keystore by running the following command:
keytool -import -alias [enter_alias_name] -trustcacerts -file [enter_certificate_filename].p7b -keystore [enter_keystore_name]
Note 1: Enter the same alias name and keystore name that was used when generating of the private key and Certificate Signing Request (CSR).
Note 2: If you receive Error Message: "java.lang.Exception: Input not an X.509 certificate", double-check the alias/keystore name entered and the format of the certificate. You may still be using the PEM (.cer or .crt) format and not the correct PKCS#7 (.p7b) format.
Alternative Installation Instructions if keytool Error Message "certificatessxception: Input not an X.509 certificate" occurs:
Using the PEM (.cer or .crt) formatted certificate, import the Intermediate Certificate into your keystore by running the following command:
keytool -import -alias intermediate -trustcacerts -file intermediate_file_name -keystore [enter_keystore_name]
Using the PEM (.cer or .crt) formatted certificate, import Your Server Certificate into your keystore by running the following command:
keytool -import -alias [enter_alias_name] -trustcacerts -file server_certificate_file_name -keystore [enter_keystore_name]
Verify the Contents of the keystore by running the following command:
keytool -list -v -keystore your_keystore_filename >output_filename.txt
Enter your keystore password.
View the Output File.
Note: Your Server Certificate will be imported into the alias by the "Entry Type" of the specified "PrivateKeyEntry".
Edit the Jetty Connector to point to the keystore and password:
<Set name="keystore"><SystemProperty name="jetty.home" default="." />/etc/keystore</Set>
<Set name="truststore"><SystemProperty name="jetty.home" default="." />/etc/keystore</Set>
Note 1: Reference Jetty Configuring Setting for a correct configuration. This Jetty Configuration documentation will also address how to set your SSL/HTTPS Ports and redirect HTTP to HTTPS.
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.