summaryrefslogtreecommitdiffstats
path: root/certs/gencerts.sh
diff options
context:
space:
mode:
Diffstat (limited to 'certs/gencerts.sh')
-rwxr-xr-xcerts/gencerts.sh2
1 files changed, 1 insertions, 1 deletions
diff --git a/certs/gencerts.sh b/certs/gencerts.sh
index 1e006c6..576d9ae 100755
--- a/certs/gencerts.sh
+++ b/certs/gencerts.sh
@@ -21,41 +21,41 @@ header() {
local i hdr
[ "$typ" = mdwn ] && printf '\n### %s ###\n' "$*" \
|| printf '\n%s\n%s\n' "$*" "$(for i in $(seq 1 ${#*}); do printf '%c' =; done)"
}
x509fpr() {
local msg="$1" host pub h spki
host="${msg%%,*}"; host="${host%% *}"; host="${host#\`}"
pub="$DIR/${host%%:*}.pub"
spki=$(openssl pkey -pubin -outform DER <"$pub" | openssl dgst -sha256 | sed -nr 's/^[^=]+=\s*//p')
[ "$typ" = mdwn ] && printf '\n[%s](https://crt.sh/?spkisha256=%s&iCAID=16418&exclude=expired)\n\n' "$msg" "$spki" \
|| printf '\n%s\n\n: X.509: https://crt.sh/?spkisha256=%s&iCAID=16418&exclude=expired\n SPKI:\n' \
"$(printf '%s' "$msg" | tr -d '`' )" "$spki"
[ "$typ" = mdwn ] && indent=":${indent#?}"
for h in sha1 sha256; do
x509fpr2 "$h" "$pub"
done
local backup=$(find "$DIR" -maxdepth 1 -type f -name "${host%%:*}.pub.back*")
if [ "$backup" -a "$typ" != mdwn ]; then
- echo " Backup pubkey:"
+ echo " Backup SPKI:"
for pub in $backup; do
x509fpr2 sha256 "$pub"
done
fi
}
x509fpr2() {
local h="$1" pub="$2" str dgst
[ "$typ" = mdwn ] && str= || str=' '
str="$str$(printf '%-6s' "$h" | tr '[a-z]' '[A-Z]')"
dgst="$(openssl pkey -pubin -outform DER <"$pub" | openssl dgst -"$h" -binary | base64)"
hd=$(printf '%s' "$dgst" | base64 -d | xxd -c256 -p | tr '[a-f]' '[A-F]' | sed -e 's/../&:/g' -e 's/:$//')
if [ $((${#str} + 1 + ${#hd})) -le 72 ]; then
printf '%s %s\n' "$indent$str" "$hd"
else
printf '%s %s\n' "$indent$str" "$dgst"
fi
indent=" ${indent#?}"
}
sshfpr() {