Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
How to convert Java Key Store file to pem/key for nginx
1. Convert our ".jks" file to ".p12" (PKCS12 key store format):
keytool -importkeystore -srckeystore oldkeystore.jks -destkeystore newkeystore.p12 -deststoretype PKCS12
1.1. List new keystore file contents:
keytool -deststoretype PKCS12 -keystore newkeystore.p12 -list
2. Extract pem (certificate) from ".p12" keysotre file:
openssl pkcs12 -nokeys -in newkeystore.p12 -out certfile.pem
3. Extract unencrypted key file from ".p12" keysotre file:
openssl pkcs12 -nocerts -nodes -in newkeystore.p12 -out keyfile.key
@fatbatman

This comment has been minimized.

Copy link

fatbatman commented Feb 27, 2014

This worked perfectly, thanks.

@KimShen

This comment has been minimized.

Copy link

KimShen commented Jul 4, 2014

Greate, thanks

@ArthurRocha

This comment has been minimized.

Copy link

ArthurRocha commented Oct 7, 2015

Good job =] tks!

@edpichler

This comment has been minimized.

Copy link

edpichler commented Dec 29, 2015

Worked here to export cert files from keytool to nginx.

@csmu-cenr

This comment has been minimized.

Copy link

csmu-cenr commented Feb 24, 2016

Cool and thanks!

@csahocska

This comment has been minimized.

Copy link

csahocska commented Jun 29, 2016

awsome! ty

@mdamir

This comment has been minimized.

Copy link

mdamir commented Jul 17, 2016

-srcalias is required in step 1 if you want to export a specific alias.

@pantherhead

This comment has been minimized.

Copy link

pantherhead commented May 19, 2017

Marvelous!! That worked well.

@cverbiest

This comment has been minimized.

Copy link

cverbiest commented Aug 31, 2017

great , thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.