X-Git-Url: https://codewiz.org/gitweb?a=blobdiff_plain;f=src%2Fshare%2Fcommon;h=d185fddf70cf142aab145ec2e7013eef2fd66b44;hb=4238a891582ba6c62fc062d24734536d029eb33a;hp=96fea7721ac3fdc31e7b922b82871a1cf4c4acda;hpb=4465c13b93d3d4bc1cb59c5506775b4fc0274058;p=monkeysphere.git diff --git a/src/share/common b/src/share/common index 96fea77..d185fdd 100644 --- a/src/share/common +++ b/src/share/common @@ -1144,3 +1144,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" +}