# output the ssh fingerprint of a gpg key
gpg_ssh_fingerprint() {
keyid="$1"
- local tmpfile=$(msmktempfile)
-
- # trap to remove tmp file if break
- trap "rm -f $tmpfile" EXIT
-
- # use temporary file, since ssh-keygen won't accept keys on stdin
- gpg_user --export "$keyid" --no-armor | openpgp2ssh "$keyid" >"$tmpfile"
- ssh-keygen -l -f "$tmpfile" | awk '{ print $1, $2, $4 }'
-
- # remove the tmp file
- trap - EXIT
- rm -rf "$tmpfile"
+ gpg_user --export "$keyid" --no-armor | "$SYSSHAREDIR/keytrans" openpgp2sshfpr "$keyid"
}
# take a secret key ID and check that only zero or one ID is provided,