rename function to get the host fingerprint, and fix some
[monkeysphere.git] / src / share / mh / import_key
index 6a897b6122ff9caed1c2c7fe300842e3311b9101..99511a86095ef9f806a6aaa8b58052867c0f047a 100644 (file)
@@ -15,12 +15,10 @@ import_key() {
 
 local hostName
 local userID
-local fingerprint
 
-# check for presence of secret key
-# FIXME: is this the proper test to be doing here?
-fingerprint_host_key >/dev/null \
-       && failure "An OpenPGP host key already exists."
+# check for presense of a key
+[ "$HOST_FINGERPRINT" ] && \
+    failure "An OpenPGP host key already exists."
 
 hostName=${1:-$(hostname -f)}
 
@@ -36,7 +34,7 @@ PEM2OPENPGP_USAGE_FLAGS=authenticate pem2openpgp "$userID" | \
     gpg_host --import
 
 # find the key fingerprint of the newly converted key
-HOST_FINGERPRINT=$(fingerprint_host_key)
+HOST_FINGERPRINT=$(get_host_fingerprint)
 export HOST_FINGERPRINT
 
 # export public key to file