summaryrefslogtreecommitdiff
path: root/src/share/common
diff options
context:
space:
mode:
Diffstat (limited to 'src/share/common')
-rw-r--r--src/share/common11
1 files changed, 11 insertions, 0 deletions
diff --git a/src/share/common b/src/share/common
index 6b7d51b..b78f64a 100644
--- a/src/share/common
+++ b/src/share/common
@@ -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"
+}