From 543ca8602909cdbfe1ac25c304bd3418756bab76 Mon Sep 17 00:00:00 2001 From: root Date: Thu, 14 Feb 2013 00:00:00 +0000 Subject: Only encrypt to keys with encrypt capability --- git-remote-gcrypt | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) (limited to 'git-remote-gcrypt') diff --git a/git-remote-gcrypt b/git-remote-gcrypt index 6c380da..49fed5f 100755 --- a/git-remote-gcrypt +++ b/git-remote-gcrypt @@ -257,10 +257,14 @@ safe_git_rev_parse() check_recipients() { - Recipients="$(gpg --no-default-keyring --keyring "$Conf_keyring" \ - --with-colons -k | xgrep ^pub | cut -f 5 -d ':' | tr '\n' ' ')" - # Split recipients by space, example "a b c" => -R a -R b -R c - Recipients=$(xecho_n "$Recipients" | sed -e 's/\([^ ]\+\)/-R &/g') + # Find which keys in the keyring we can encrypt to + Recipients=$(gpg --no-default-keyring --keyring "$Conf_keyring" \ + --with-colons --fast-list -k | xgrep ^pub | \ + while read rc_line; do + cap_=$(xecho "$rc_line" | cut -f 12 -d :) + keyid_=$(xecho "$rc_line" | cut -f 5 -d :) + iseq "${cap_#*E}" "$cap_" || xecho_n "-R $keyid_ " + done) if isnull "$Recipients" then echo_info "You must configure a keyring for the repository." -- cgit v1.2.3