From 57b6f18675da62363c4c35a5d62f3a4e4a2cc69a Mon Sep 17 00:00:00 2001 From: Guilhem Moulin Date: Sun, 20 Dec 2015 14:36:42 +0100 Subject: Improve gencert.sh --- certs/gencerts.sh | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/certs/gencerts.sh b/certs/gencerts.sh index 047bba1..8164945 100755 --- a/certs/gencerts.sh +++ b/certs/gencerts.sh @@ -22,11 +22,11 @@ x509fpr() { host="${msg%%,*}"; host="${msg%% *}" cert="$DIR/${host%%:*}.pem" spki=$(openssl x509 -noout -pubkey<"$cert" | openssl pkey -pubin -outform DER | openssl dgst -sha1 | sed -nr 's/^[^=]+=\s*//p') - [ "$typ" = mdwn ] && { echo; echo " $msg"; echo; } || echo " $msg" - echo "${indent}X.509: https://crt.sh/?spkisha1=${spki}&iCAID=7395" - echo "${indent}SPKI:" + [ "$typ" = mdwn ] && printf '\n [[%s|https://crt.sh/?spkisha1=%s&iCAID=7395]]\n\n' "$msg" "$spki" \ + || printf ' %s\n X.509: https://crt.sh/?spkisha1=%s&iCAID=7395\n SPKI:\n' "$msg" "$spki" for h in sha1 sha256; do - echo -n " $h" | tr '[a-z]' '[A-Z]' + [ "$typ" = mdwn ] || echo -n ' ' + echo -n "$h" | tr '[a-z]' '[A-Z]' for i in $(seq 1 $((7 - ${#h}))); do echo -n ' '; done openssl x509 -noout -pubkey<"$cert" | openssl pkey -pubin -outform DER | openssl dgst -"$h" -c | sed -nr 's/^[^=]+=\s*//p' done | sed -r "s/(\S+)(.*)/$indent\1\U\2/" -- cgit v1.2.3