-# export the host key to the monkeysphere host file key
-gpg_host_export_to_ssh_file() {
- log debug "exporting openpgp public key..."
- gpg_host_export > "${MHDATADIR}/ssh_host_rsa_key.pub.gpg"
- log info "SSH host public key in OpenPGP form: ${MHDATADIR}/ssh_host_rsa_key.pub.gpg"
+# load the host fingerprint into the fingerprint variable, using the
+# export gpg pub key file
+# FIXME: this seems much less than ideal, with all this temp keyring
+# stuff. is there a way we can do this without having to create temp
+# files? what if we stored the fingerprint in MHDATADIR/fingerprint?
+load_fingerprint() {
+ if [ -f "$HOST_KEY_FILE" ] ; then
+ HOST_FINGERPRINT=$( \
+ (FUBAR=$(mktemp -d) && export GNUPGHOME="$FUBAR" \
+ && gpg --quiet --import \
+ && gpg --quiet --list-keys --with-colons --with-fingerprint \
+ && rm -rf "$FUBAR") <"$HOST_KEY_FILE" \
+ | grep '^fpr:' | cut -d: -f10 )
+ else
+ HOST_FINGERPRINT=
+ fi