Created
July 20, 2018 07:52
-
-
Save cvockrodt/77d4089f326563d830c0fa5aa651fa76 to your computer and use it in GitHub Desktop.
Convert p12 to jks (letsencrypt)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
certdir=/etc/ssl/private | |
keystore_path=/etc/letsencrypt/archive/example.com/keystore1.jks | |
letsdir=/etc/letsencrypt/archive/example.com | |
password=yourpasswordhere | |
for i in {6..1}; do cp $letsdir/keystore$i.jks $letsdir/keystore$((i+1)).jks; done | |
keytool -delete -alias root -storepass $password -keystore $keystore_path | |
keytool -delete -alias 1 -storepass $password -keystore $keystore_path | |
keytool -importkeystore -srcstorepass $password -deststorepass $password -destkeypass $password -srckeystore $certdir/cert.p12 -srcstoretype PKCS12 -alias 1 -keystore $keystore_path | |
keytool -import -trustcacerts -alias root -deststorepass $password -file $certdir/chain.pem -noprompt -keystore $keystore_path |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment