Skip to content

Instantly share code, notes, and snippets.

@todgru
Forked from ilguzin/gist:6606011
Created February 23, 2017 18:38
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save todgru/48b1482e64d1318a4dc429545ace43ce to your computer and use it in GitHub Desktop.
Save todgru/48b1482e64d1318a4dc429545ace43ce to your computer and use it in GitHub Desktop.
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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment