Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I create keystore from an existing certificate (abc.crt) and abc.key files?

Tags:

ssl

keytool

I am trying to import a certificate and a key file into the keystore but I'm unable to do that.

How can I create a keystore by importing both an existing certificate (abc.crt) and abc.key files?

like image 982
Ravi Jain Avatar asked Aug 14 '12 12:08

Ravi Jain


1 Answers

The easiest is probably to create a PKCS#12 file using OpenSSL:

openssl pkcs12 -export -in abc.crt -inkey abc.key -out abc.p12 

You should be able to use the resulting file directly using the PKCS12 keystore type.

If you really need to, you can convert it to JKS using keytool -importkeystore (available in keytool from Java 6):

keytool -importkeystore -srckeystore abc.p12 \         -srcstoretype PKCS12 \         -destkeystore abc.jks \         -deststoretype JKS 
like image 153
Bruno Avatar answered Sep 18 '22 01:09

Bruno