How do I import an openssl based generated private key and certificate into java keystore?

May 25, 2018 in SSL Technical FAQs

To import an openssl based generated private key and certificate into java keystore, follow the instructions below.

First you will have to create a new text file, which contains the cert from 'yourdomain.crt' and the private key from 'yourdomain.key'.
It must be like this:

BEGIN CERTIFICATE
lines of text between the Begin and End
END CERTIFICATE
BEGIN RSA PRIVATE KEY
lines of text between the Begin and End
END RSA PRIVATE KEY

NOTE: Do not include the extra text which is inserted by openssl

Save the text file as 'cert_with_key.pem'

Using the Java Keytool command:
keytool -import -file cert_with_key.pem -alias sitecertkey

You will also need to import the other certificates that came with your site certificate for the certificates to chain to a trusted root.
These will be attached to the email you received, or can be downloaded from:
https://support.sectigo.com/Com_KnowledgeDetailPage?Id=kA01N000000rfBO

Then follow the import instructions for the intermediate/roots at: https://support.sectigo.com/Com_KnowledgeDetailPage?Id=kA01N000000zFSe