I requested a SSL certificate from an authority.
First, I created a .csr and a .key file on my computer and saved those. I sent the .csr and got back a .crt file and other files that I installed on my server.
All works fine for my Apache server with an SSL connection. However, I would like to be able to use the same certificate for a Tomcat server that I also have running on the system on a different port (Using JIRA). The setup needs a .jks file. Is it possible to generate that from the files that I have?
This seems like it might work, but I don't have that utility in my CLASSPATH or cannot find it.
Oracle instructions
crt and key files represent both parts of a certificate, key being the private key to the certificate and crt being the signed certificate. It's only one of the ways to generate certs, another way would be having both inside a pem file or another in a p12 container.
You can use openssl and keytool
openssl pkcs12 -export -out domainname.pfx -inkey domainname.key -in domainname.crt -password pass:mypassword
keytool -importkeystore -srckeystore domainname.pfx -srcstoretype pkcs12 -srcalias 1 -srcstorepass mypassword -destkeystore domainname.jks -deststoretype jks -deststorepass mypassword -destalias myalias
Where
You can convert a PFX from those files:
openssl pkcs12 -export -out domain.name.pfx -inkey domain.name.key -in domain.name.crt
Then export the jks from the PFX by following this guide:
https://blogs.oracle.com/blogbypuneeth/post/steps-to-create-a-jks-keystore-using-key-and-crt-files
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With