added 'der' encoding recognize

This commit is contained in:
Pavel Muhortov 2024-06-19 18:44:34 +03:00
parent f046396eb4
commit 6ccdec2764

View File

@ -35,7 +35,11 @@ if [ -n "${certdest}" ]; then
certpath="$(printf "%s" "${certdest}" | cut -d':' -f1)"
if [ -f "${certpath}" ]; then
certdata=$(cat "${certpath}")
if grep -q 'BEGIN CERTIFICATE' "${certpath}"; then
certdata=$(openssl x509 -inform pem -in "${certpath}")
else
certdata=$(openssl x509 -inform der -in "${certpath}")
fi
else
certport="$(printf "%s" "${certdest}" | cut -d':' -f2 -s)"