Skip to content

Instantly share code, notes, and snippets.

@JigSawFr
Forked from pjosalgado/jks-to-nginx-command-list
Last active October 24, 2017 14:28
Show Gist options
  • Save JigSawFr/ee506b0656c7e5a27e5a5627f483d32d to your computer and use it in GitHub Desktop.
Save JigSawFr/ee506b0656c7e5a27e5a5627f483d32d 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):
/opt/applications/confluence/jre/bin/keytool -importkeystore -srckeystore /opt/applications/confluence-ssl/tomcat.keystore -destkeystore tomcat.p12 -deststoretype PKCS12
# 2. Extract pem (certificate) from ".p12" keystore file:
openssl pkcs12 -nokeys -in tomcat.p12 -out certificate-chain.pem
# 3. Extract unencrypted key file from ".p12" keystore file:
openssl pkcs12 -nocerts -nodes -in tomcat.p12 -out unencrypted-key.key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment