Simplify the function to covert pfx certificate (#5086)

This commit is contained in:
xumia 2020-08-01 20:07:20 +08:00 committed by Qi Luo
parent 17fd575b66
commit 1abf7be730

View File

@ -29,6 +29,8 @@ done
( [ -z $PFX_FILE ] || [ -z $SIGNING_KEY ] || [ -z $SIGNING_CERT ] || [ -z $CA_CERT ] ) && exit 1
openssl pkcs12 -in "${PFX_FILE}" -clcerts -nokeys -nodes -passin pass: | sed -z -e "s/.*\(-----BEGIN CERTIFICATE\)/\1/" > ${SIGNING_CERT}
openssl pkcs12 -in "${PFX_FILE}" -nocerts -nodes -passin pass: | sed -z -e "s/.*\(-----BEGIN PRIVATE KEY\)/\1/" > ${SIGNING_KEY}
openssl pkcs12 -in "${PFX_FILE}" -clcerts -nokeys -nodes -passin pass: -out ${SIGNING_CERT}
openssl pkcs12 -in "${PFX_FILE}" -nocerts -nodes -passin pass: -out ${SIGNING_KEY}
# Export the last intermediate CA ceritficate
openssl pkcs12 -in "${PFX_FILE}" -cacerts -nokeys -nodes -passin pass: | sed -z -e "s/.*\(-----BEGIN CERTIFICATE\)/\1/" > ${CA_CERT}