diff --git a/cert-info.sh b/cert-info.sh index 172cb63..7f6cdef 100644 --- a/cert-info.sh +++ b/cert-info.sh @@ -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)"