made gpg_sphere use --quiet again, and now doing more explicit extraction of key...
[monkeysphere.git] / src / share / common
index 6b7d51bab1f0b03e0d15b145daaae03052c01898..b78f64a3156a54ea8372df40999e2d5de4770d77 100644 (file)
@@ -1100,3 +1100,14 @@ process_authorized_user_ids() {
 
     update_authorized_keys "${userIDs[@]}"
 }
+
+# takes a gpg key or keys on stdin, and outputs a list of
+# fingerprints, one per line:
+list_primary_fingerprints() {
+    local file="$1"
+    local fake=$(msmktempdir)
+    GNUPGHOME="$fake" gpg --no-tty --quiet --import
+    GNUPGHOME="$fake" gpg --with-colons --fingerprint --list-keys | \
+       awk -F: '/^fpr:/{ print $10 }'
+    rm -rf "$fake"
+}