aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xshare/keyringer/recrypt15
1 files changed, 11 insertions, 4 deletions
diff --git a/share/keyringer/recrypt b/share/keyringer/recrypt
index 695e789..9153456 100755
--- a/share/keyringer/recrypt
+++ b/share/keyringer/recrypt
@@ -14,16 +14,23 @@ function keyringer_recrypt {
# Set recipients file
keyringer_set_recipients "$FILE"
- # Set pipefail so we can detect decryption failures
- set -o pipefail
+ # Decrypt
+ decrypted="$($GPG --use-agent -d "$KEYDIR/$FILE" 2> /dev/null)"
+
+ if [ "$?" != "0" ]; then
+ echo "Decryption error."
+ exit 1
+ fi
# Recrypt
- $GPG --use-agent -d "$KEYDIR/$FILE" | \
- $GPG --use-agent --armor -e -s $(keyringer_recipients "$RECIPIENTS_FILE") > "$KEYDIR/$FILE"
+ echo "$decrypted" | $GPG --use-agent --armor -e -s $(keyringer_recipients "$RECIPIENTS_FILE") > "$KEYDIR/$FILE"
if [ "$?" != "0" ]; then
+ echo "Recryption error."
exit 1
fi
+
+ unset decrypted
}
if [ ! -z "$2" ]; then