+ for key in $keys ; do
+ printf '%s\n' "${fprs[@]}" | grep "${key}$" \
+ || failure "Key '$key' not found."
+ done
+ fi
+
+ for key in $keys ; do
+ if (( i++ > 0 )) ; then
+ echo "##############################"
+ fi
+ eval "$cmd" "$key"
+ done
+}
+
+# show info about the a key
+show_key() {
+ local id="$1"
+ local GNUPGHOME
+ local TMPSSH
+ local fingerprint
+ local revokers
+
+ # tmp gpghome dir
+ export GNUPGHOME=$(msmktempdir)
+
+ # trap to remove tmp dir if break
+ trap "rm -rf $GNUPGHOME" EXIT
+
+ # import the host key into the tmp dir
+ gpg --quiet --import <"$HOST_KEY_FILE"
+
+ # create the ssh key
+ TMPSSH="$GNUPGHOME"/ssh_host_key_rsa_pub
+ gpg --export "$id" | openpgp2ssh 2>/dev/null >"$TMPSSH"
+
+ # get the gpg fingerprint
+ fingerprint=$(gpg --quiet --list-keys \
+ --with-colons --with-fingerprint "$id" \
+ | grep '^fpr:' | cut -d: -f10 )
+
+ # list the host key info
+ # FIXME: make no-show-keyring work so we don't have to do the grep'ing
+ # FIXME: can we show uid validity somehow?
+ gpg --list-keys --list-options show-unusable-uids "$id" 2>/dev/null \
+ | grep -v "^${GNUPGHOME}/pubring.gpg$" \
+ | egrep -v '^-+$'
+
+ # list revokers, if there are any
+ revokers=$(gpg --list-keys --with-colons --fixed-list-mode "$id" \
+ | awk -F: '/^rvk:/{ print $10 }' )
+ if [ "$revokers" ] ; then
+ echo "The following keys are allowed to revoke this host key:"
+ for key in $revokers ; do
+ echo "revoker: $key"
+ done
+ echo