Created
February 2, 2019 09:19
-
-
Save peatiscoding/df5c1367a883dea3a2799ad50eceb274 to your computer and use it in GitHub Desktop.
A Shell script to convert Certificate in PEM + private key to JKS
This file contains 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/sh | |
# Before start make sure you have created a CSR and issued a CRT files from Server. | |
# | |
# openssl req -new -newkey rsa:2048 -nodes -keyout private.key -out ${1}.csr | |
# | |
# unzip ${1}.zip | |
# cat ${1}.crt > ${1}.pem | |
# cat ${1}.ca-bundle >> ${1}.pem | |
# Required Input | |
export TARGET_DOMAIN=${1} | |
echo "Creating p12 file: ${TARGET_DOMAIN}.p12" | |
openssl pkcs12 -export -out ${TARGET_DOMAIN}.p12 -inkey private.key -in ${TARGET_DOMAIN}.pem | |
echo "Covert p12 to jks" | |
keytool -importkeystore -srckeystore ${TARGET_DOMAIN}.p12 -srcstoretype pkcs12 -destkeystore ${TARGET_DOMAIN}.jks -deststoretype jks | |
echo "DONE." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment