From 1abf7be730262caa1b8df9f494e44fd762e71077 Mon Sep 17 00:00:00 2001 From: xumia <59720581+xumia@users.noreply.github.com> Date: Sat, 1 Aug 2020 20:07:20 +0800 Subject: [PATCH] Simplify the function to covert pfx certificate (#5086) --- scripts/convert-pfx-cert-format.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/scripts/convert-pfx-cert-format.sh b/scripts/convert-pfx-cert-format.sh index c98528b6dc..4615dbdf85 100755 --- a/scripts/convert-pfx-cert-format.sh +++ b/scripts/convert-pfx-cert-format.sh @@ -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}