X-Git-Url: https://git.grml.org/?a=blobdiff_plain;f=etc%2Fzsh%2Fzshrc;h=62218613fbe243db2f275a73f77c1314c9a24dee;hb=4e196b418a303d3badcb9479e36e949a2daf3d1a;hp=c7ddace9f8a7369e6a15ec2f43ca41c15ca7a047;hpb=35aa71ae6f12db7fa22d0924e850761625a9da90;p=grml-etc-core.git diff --git a/etc/zsh/zshrc b/etc/zsh/zshrc index c7ddace..6221861 100644 --- a/etc/zsh/zshrc +++ b/etc/zsh/zshrc @@ -2985,6 +2985,41 @@ exit 0; return $? } +ssl_hashes=( sha512 sha256 sha1 md5 ) + +for sh in ${ssl_hashes}; do + ssl-cert-${sh}() { + emulate -L zsh + if [[ -z $1 ]] ; then + printf 'usage: %s \n' "ssh-cert-${sh}" + return 1 + fi + openssl x509 -noout -fingerprint -${sh} -in $1 + } +done; unset sh + +ssl-cert-fingerprints() { + emulate -L zsh + local i + if [[ -z $1 ]] ; then + printf 'usage: ssl-cert-fingerprints \n' + return 1 + fi + for i in ${ssl_hashes} + do ssl-cert-$i $1; + done +} + +ssl-cert-info() { + emulate -L zsh + if [[ -z $1 ]] ; then + printf 'usage: ssl-cert-info \n' + return 1 + fi + openssl x509 -noout -text -in $1 + ssl-cert-fingerprints $1 +} + # }}} # {{{ make sure our environment is clean regarding colors