JKS to PEM conversion

Situation:

I've generated a private key using keytool. I've created a CSR file with this private key and signed it with a CA. I'm using this successfully in my java projects and with Tomcat.

Now, I need to use this SSL certificate with Nginx server. To do so, I need to provide the private key and certificate file to Nginx.

I've got the CRT files from CA. But the question is, how to use the keytool generated private key with Nginx or other servers?  

Solution:

We need to extract the private key from the keystore file and save it in a format so that other servers can recognize it.

Extract the private key from keystore using this tool https://code.google.com/p/java-exportpriv/wiki/Usage

Use the following command to extract the private key in PKCS#8 format
java ExportPriv .keystore mykey test123

You can use this private key with Nginx or Apache who does not support keytool generated private key.

Comments

Popular posts from this blog

Run tasks in background in Spring

Conditional field inclusion in Jackson and Spring Boot

How to configure Wildfly 10 to use MySQL