Skip to content

Instantly share code, notes, and snippets.

@iamdvr
Forked from pjosalgado/jks-to-nginx-command-list
Created April 25, 2019 12:08
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save iamdvr/b05885e351befbe5fed3d13969c37cdf to your computer and use it in GitHub Desktop.
Save iamdvr/b05885e351befbe5fed3d13969c37cdf 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 keystore format):
keytool -importkeystore -srckeystore { java-keystore.jks } -destkeystore { pkcs12-keystore.p12 } -deststoretype PKCS12
2. Extract pem (certificate) from ".p12" keystore file:
openssl pkcs12 -nokeys -in { pkcs12-keystore.p12 } -out { certificate-chain.pem }
3. Extract unencrypted key file from ".p12" keystore file:
openssl pkcs12 -nocerts -nodes -in { pkcs12-keystore.p12 } -out { unencrypted-key.key }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment