Skip to content

Instantly share code, notes, and snippets.

@justin-lyon
Created August 14, 2020 17:46
Show Gist options
  • Save justin-lyon/300b2b557845f2c0fc8cda52c0b49911 to your computer and use it in GitHub Desktop.
Save justin-lyon/300b2b557845f2c0fc8cda52c0b49911 to your computer and use it in GitHub Desktop.
Create a .jks file from a .key / .cert pair.

Create a Java Keystore file from a .key/.cert pair

Input your key and cert to create a cert.pfx file with the password "src-passwordForCert.pfx"

openssl pkcs12 -export -out cert.pfx -inkey server.key -in server.crt -password pass:src-passwordForCert.pfx

Convert cert.pfx to a .jks file. This command will prompt you to create a new password for the .jks (destination), then it will ask you for the password to cert.pfx (source).

keytool -importkeystore -srckeystore cert.pfx -destkeystore nb-data-services.jks -srcstoretype pkcs12

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment