The Magic
First we need to convert the key into something that keytool can import into our keystore. It turns out that keytool can import a private key by using a work around that uses two different features: using a PKCS12 formatted key as a keystore and merging keystores.
A Quick Read
# Convert PEM to PKCS12 format. openssl pkcs12 -export -out certificate.pfx -in certificate.pem # Import into our keystore keytool -importkeystore -destkeystore my-keystore.jks -srckeystore certificate.pfx -srcstoretype PKCS12 -alias 1 # The openssl export does not preserve the alias name, it uses "1", so rename it. keytool -changealias -alias "1" -destalias "my_signing_key" -keystore my-keystore.jks
No comments:
Post a Comment