Refactor export_pkcs() - Quote all expansions (#494)
Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
This commit is contained in:
parent
4b9b3ed657
commit
2396b2f41a
@ -1742,7 +1742,6 @@ Run easyrsa without commands for usage and command help."
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
pkcs_opts=
|
|
||||||
pkcs_certfile_path=
|
pkcs_certfile_path=
|
||||||
if [ "$want_ca" ]; then
|
if [ "$want_ca" ]; then
|
||||||
verify_file x509 "$crt_ca" || die "\
|
verify_file x509 "$crt_ca" || die "\
|
||||||
@ -1766,16 +1765,17 @@ Unable to export p12 for short name '$short_name' without the key
|
|||||||
(if you want a p12 without the private key, use nokey option.)
|
(if you want a p12 without the private key, use nokey option.)
|
||||||
Missing key expected at: $key_in"
|
Missing key expected at: $key_in"
|
||||||
else
|
else
|
||||||
pkcs_opts="-nokeys"
|
nokeys=1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# export the p12:
|
# export the p12:
|
||||||
# shellcheck disable=SC2086 # Ignore unquoted variables
|
# shellcheck disable=SC2086 # Ignore unquoted variables
|
||||||
easyrsa_openssl pkcs12 -in "$crt_in" -inkey "$key_in" -export \
|
easyrsa_openssl pkcs12 -in "$crt_in" -inkey "$key_in" -export \
|
||||||
-out "$pkcs_out" $pkcs_opts \
|
-out "$pkcs_out" \
|
||||||
${pkcs_certfile_path:+-certfile "$pkcs_certfile_path"} \
|
${nokeys:+ -nokeys} \
|
||||||
${EASYRSA_PASSIN:+-passin "$EASYRSA_PASSIN"} \
|
${pkcs_certfile_path:+ -certfile "$pkcs_certfile_path"} \
|
||||||
${EASYRSA_PASSOUT:+-passout "$EASYRSA_PASSOUT"} || die "\
|
${EASYRSA_PASSIN:+ -passin "$EASYRSA_PASSIN"} \
|
||||||
|
${EASYRSA_PASSOUT:+ -passout "$EASYRSA_PASSOUT"} || die "\
|
||||||
Export of p12 failed: see above for related openssl errors."
|
Export of p12 failed: see above for related openssl errors."
|
||||||
;;
|
;;
|
||||||
p7)
|
p7)
|
||||||
@ -1784,22 +1784,24 @@ Export of p12 failed: see above for related openssl errors."
|
|||||||
# export the p7:
|
# export the p7:
|
||||||
easyrsa_openssl crl2pkcs7 -nocrl -certfile "$crt_in" \
|
easyrsa_openssl crl2pkcs7 -nocrl -certfile "$crt_in" \
|
||||||
-out "$pkcs_out" \
|
-out "$pkcs_out" \
|
||||||
${pkcs_certfile_path:+-certfile "$pkcs_certfile_path"} \
|
${pkcs_certfile_path:+ -certfile "$pkcs_certfile_path"} \
|
||||||
|| die "\
|
|| die "\
|
||||||
Export of p7 failed: see above for related openssl errors."
|
Export of p7 failed: see above for related openssl errors."
|
||||||
;;
|
;;
|
||||||
p8)
|
p8)
|
||||||
if [ -z "$want_pass" ]; then
|
|
||||||
pkcs_opts="-nocrypt"
|
|
||||||
fi
|
|
||||||
pkcs_out="$EASYRSA_PKI/private/$short_name.p8"
|
pkcs_out="$EASYRSA_PKI/private/$short_name.p8"
|
||||||
|
|
||||||
|
if [ -z "$want_pass" ]; then
|
||||||
|
EASYRSA_PASSIN=pass:
|
||||||
|
EASYRSA_PASSOUT=pass:
|
||||||
|
fi
|
||||||
|
|
||||||
# export the p8:
|
# export the p8:
|
||||||
# shellcheck disable=SC2086 # Ignore unquoted variables
|
# shellcheck disable=SC2086 # Ignore unquoted variables
|
||||||
easyrsa_openssl pkcs8 -in "$key_in" -topk8 \
|
easyrsa_openssl pkcs8 -in "$key_in" -topk8 \
|
||||||
-out "$pkcs_out" $pkcs_opts \
|
-out "$pkcs_out" $pkcs_opts \
|
||||||
${EASYRSA_PASSIN:+-passin "$EASYRSA_PASSIN"} \
|
${EASYRSA_PASSIN:+ -passin "$EASYRSA_PASSIN"} \
|
||||||
${EASYRSA_PASSOUT:+-passout "$EASYRSA_PASSOUT"} || die "\
|
${EASYRSA_PASSOUT:+ -passout "$EASYRSA_PASSOUT"} || die "\
|
||||||
Export of p8 failed: see above for related openssl errors."
|
Export of p8 failed: see above for related openssl errors."
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user