Anil Datt Blogs

Importing SSH generated keys to weblogic DemoTrust java key store

posted Apr 23, 2013, 10:23 AM by Anil Datt   [ updated Apr 23, 2013, 10:24 AM ]

java Keytool does not let you directly import the keys that are created using SSH-keygen into Java key store(.jks file).

Here are the steps to import it.

1. Convert the key to  X509 pem format

openssl req -new -x509 -key id_rsa -out id_pem

Answer the questions

You are about to be asked to enter information that will be incorporated
into your certificate request.
What you are about to enter is what is called a Distinguished Name or a DN.
There are quite a few fields but you can leave some blank
For some fields there will be a default value,
If you enter '.', the field will be left blank.
Country Name (2 letter code) [GB]:us
State or Province Name (full name) [Berkshire]:nj.................


.pem file is generated 

id_pem  id_rsa  known_hosts

2. Import the keys to weblogic demo trust store

    keytool -import -alias mykey -trustcacerts -file /home/dathu/.ssh/id_pem -keystore DemoTrust.jks

    Enter the password for the DemoTrust key store when prompted

    Trust this certificate? [no]:  yes
    Certificate was added to keystore

1-1 of 1