From 6ccdec2764796938f0aa0766f8738dbf483dc232 Mon Sep 17 00:00:00 2001 From: Pavel Muhortov Date: Wed, 19 Jun 2024 18:44:34 +0300 Subject: [PATCH] added 'der' encoding recognize --- cert-info.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) 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)"