Changeset - 47859cb4f774
[Not reviewed]
0 1 0
Branko Majic (branko) - 4 years ago 2020-06-29 04:18:12
branko@majic.rs
Make sure that when exporting a public key only one specific subkey is exported. Fixed a typo in error message.
1 file changed with 2 insertions and 2 deletions:
0 comments (0 inline, 0 general) First comment
openpgp/gitprotect.sh
Show inline comments
 
@@ -252,13 +252,13 @@ elif [[ $command == "addkey" ]]; then
 
                echo "ERROR: Failed to add key from file '$key'." >&2
 
            fi
 
        else
 
            if ! gpg2 --batch --list-keys "$key" >/dev/null 2>&1; then
 
                echo "WARN: Key with identifier '$key' not found in user's GnuPG keyring. Skipping." >&2
 
            else
 
                ! gpg2 --batch --armor --export "$key" | gpg2 "${gnupgArgs[@]}" --import
 
                ! gpg2 --batch --armor --export "${key}!" | gpg2 "${gnupgArgs[@]}" --import
 
                if [[ ${PIPESTATUS[0]} != 0 ]]; then
 
                    echo "ERROR: Failed to add key with identifier '$key')." >&2
 
                fi
 
            fi
 
        fi
 
    done
 
@@ -300,13 +300,13 @@ elif [[ $command = "encrypt" ]]; then
 
            recipientArgs+=("-r" "$key_id")
 
        fi
 
    done < <(gpg2 "${gnupgArgs[@]}" --list-public-keys --with-colons | grep '^sub' | awk 'BEGIN { FS = ":" } ; { print $2, $5, $12 }')
 

	
 
    # Make sure that we have at least a single recipient.
 
    if [[ "${#recipients[@]}" == 0 ]]; then
 
        echo "ERROR: No suitable recipients were found in the keyring. Did you forget ot add keys?" >&2
 
        echo "ERROR: No suitable recipients were found in the keyring. Did you forget to add keys?" >&2
 
        exit "$ERR_NORECIPIENTS"
 
    fi
 

	
 
    # Encrypt every file from the decrypted sub-directory.
 
    while read decryptedFile; do
 
        filename=$(basename "$decryptedFile")
0 comments (0 inline, 0 general) First comment
You need to be logged in to comment. Login now