Ask a Question

Import Thawte SSL Certificate into Jetty Java HTTP Servlet Web Server

Problem

Import Certificate into Jetty Java HTTP Servlet Web Server

Solution

Follow the instructions below to install the certificate on a Jetty Server

Step 1: Download your Thawte certificate in PKCS#7 format

  1. You will receive an email when your certificate is issued.
  2. Certificate Center Enterprise
    Certificate Center
    Partner Orders
  3. Copy and Paste your Thawte certificate to a plain text editor such as Notepad or Vi and save as cert.p7b

    NOTE: Make sure there are 5 dashes to either side of the BEGIN PKCS#7 and END PKCS#7 and that no white space, extra line breaks or additional characters have been inadvertently added.

Step 2: Install your certificate

  1. Import the certificate into the Java keystore using the following keytool command: 
     
    keytool -import -alias [enter_alias_name] -trustcacerts -file cert.p7b -keystore [enter_keystore_name]

    NOTE: The alias name and keystore name in this command must be the same as the alias name and keystore name
    used during the generation of the private key and CSR.

    NOTE: During the import you might get following error: Error: "java.lang.Exception: Input not an X.509 certificate".

    Click here to troubleshoot this error message.
     

Alternate installation instruction if above error with "keytool error: certificatessxception: Input not an X.509 certificate" occur.

  1. Follow Step 1 by downloading an X.509 certificate file format.
  2. Download the Intermediate certificate
  3. Select the Intermediate CA link based on your certificate product type.  Once you have the SSL certificate & Intermediate CA certificate file, begin the import process.
    NOTE: It is imperative the installation of Intermediate CA and SSL certificate on the keystore is followed below.
  4. Import the Intermediate certificate (e.g., use alias: intermediate)

    keytool -import -alias intermediate -trustcacerts -file intermediate_file_name  -keystore [enter_keystore_name]
     
  5. Import the SSL certificate (Use the same alias name based on the created keystore and submitted CSR from Thawte)

    keytool -import -alias [enter_alias_name] -trustcacerts -file X.509_file_name  -keystore [enter_keystore_name]
     

Step 3: Confirm the contents of the keystore

Enter the following command to list the contents of the keystore:

keytool -list -v -keystore  your_keystore_filename >output_filename.txt

For Example:


 

View the contents of the output file.

The SSL certificate is imported into the alias with the "Entry Type" of PrivateKeyEntry or KeyEntry.  If not, please import the certificate into the Private Key alias.

 

Step 4: Configure Jetty server

  1. Configure the Jetty connector to point to the Keystore and password:
    Example:
    <Call name="addConnector">
        <Arg>
          <New class="org.mortbay.jetty.security.SslSocketConnector">
            <Set name="Port">8443</Set>
            <Set name="maxIdleTime">30000</Set>
            <Set name="keystore"><SystemProperty name="jetty.home" default="." />/etc/keystore</Set>
            <Set name="password">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
            <Set name="keyPassword">OBF:1u2u1wml1z7s1z7a1wnl1u2g</Set>
            <Set name="truststore"><SystemProperty name="jetty.home" default="." />/etc/keystore</Set>
            <Set name="trustPassword">OBF:1vny1zlo1x8e1vnw1vn61x8g1zlu1vn4</Set>
          </New>
        </Arg>
      </Call>

NOTE: Use Jetty Configuring Setting reference for a correct configuration Configure Jetty

The SSL Port needs to be enabled on Jetty Java HTTP Servlet Web Server as well as on any firewall/s or router/s in place.

NOTE: Jetty Documentation

 

Step 5: Verify certificate installation

To verify if your certificate is installed correctly, use the Thawte Installation Checker