From 27f5d7874472abf9cd115df90fef520ad6f89a35 Mon Sep 17 00:00:00 2001 From: Christoph Date: Fri, 4 Aug 2017 14:09:17 +0200 Subject: [PATCH] Add script 'get_cert_details.sh'. --- get_cert_details.sh | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100755 get_cert_details.sh diff --git a/get_cert_details.sh b/get_cert_details.sh new file mode 100755 index 0000000..f1055fb --- /dev/null +++ b/get_cert_details.sh @@ -0,0 +1,36 @@ +#!/usr/bin/env bash + + +function usage() { + + echo + + if [ -n "$1" ];then + echo -e "Error: $1\n" + fi + cat <\n" + +EOF + exit 1 +} + +while getopts h opt ; do + case $opt in + h) usage + ;; + *) usage + ;; + esac +done + +[ $# -ne "1" ] && usage "wrong number of arguments" + +cert_file=$1 + +openssl x509 -noout -text -in $cert_file + +exit $?