aboutsummaryrefslogtreecommitdiff
path: root/share
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2012-02-27 11:25:28 -0300
committerSilvio Rhatto <rhatto@riseup.net>2012-02-27 11:25:28 -0300
commite6d3f3e0c5671ff853404a962d856ec493b8dbdb (patch)
tree61959b54f3b2ac214de733472f77bf8872bd1c2b /share
parent8fa3ddbc6cdf5adb3414c782ff83c371b17d38d8 (diff)
downloadkeyringer-e6d3f3e0c5671ff853404a962d856ec493b8dbdb.tar.gz
keyringer-e6d3f3e0c5671ff853404a962d856ec493b8dbdb.tar.bz2
Multiple recipients file support
Diffstat (limited to 'share')
-rwxr-xr-xshare/keyringer/edit5
-rwxr-xr-xshare/keyringer/encrypt5
-rwxr-xr-xshare/keyringer/recipients31
-rwxr-xr-xshare/keyringer/recrypt5
4 files changed, 40 insertions, 6 deletions
diff --git a/share/keyringer/edit b/share/keyringer/edit
index 73a59d9..10798e2 100755
--- a/share/keyringer/edit
+++ b/share/keyringer/edit
@@ -10,6 +10,9 @@ source "$LIB" || exit 1
# Get file
keyringer_get_file "$2"
+# Set recipients file
+keyringer_set_recipients "$FILE"
+
# Warn user
echo "Make sure that $BASEDIR is atop of an encrypted volume."
@@ -25,7 +28,7 @@ read key
"$EDITOR" "$TMPWORK"
# Encrypt again
-$GPG --yes -o "$KEYDIR/$FILE" --use-agent --armor -e -s $(keyringer_recipients "$RECIPIENTS") "$TMPWORK"
+$GPG --yes -o "$KEYDIR/$FILE" --use-agent --armor -e -s $(keyringer_recipients "$RECIPIENTS_FILE") "$TMPWORK"
# Remove temp file
keyringer_unset_tmpfile "$TMPWORK"
diff --git a/share/keyringer/encrypt b/share/keyringer/encrypt
index 709aac3..da0941f 100755
--- a/share/keyringer/encrypt
+++ b/share/keyringer/encrypt
@@ -10,6 +10,9 @@ source "$LIB" || exit 1
# Aditional parameters
keyringer_get_new_file "$2"
+# Set recipients file
+keyringer_set_recipients "$FILE"
+
# Encrypt
mkdir -p "$KEYDIR/`dirname $FILE`"
@@ -18,7 +21,7 @@ if [ "$BASENAME" == "encrypt" ]; then
echo "Type your message and finish your input with EOF (Ctrl-D)."
fi
-$GPG --use-agent --armor -e -s $(keyringer_recipients "$RECIPIENTS") - > "$KEYDIR/$FILE"
+$GPG --use-agent --armor -e -s $(keyringer_recipients "$RECIPIENTS_FILE") - > "$KEYDIR/$FILE"
# Stage
if [ -d "$BASEDIR/.git" ]; then
diff --git a/share/keyringer/recipients b/share/keyringer/recipients
index 2fe2ddf..ab61bd7 100755
--- a/share/keyringer/recipients
+++ b/share/keyringer/recipients
@@ -10,11 +10,36 @@ source "$LIB/functions" || exit 1
# Command parser
keyringer_get_command "$2"
+# Set recipients file
+keyringer_set_new_recipients "$3"
+
if [ "$COMMAND" == "ls" ]; then
- cat "$RECIPIENTS"
+ if [ ! -z "$3" ]; then
+ if [ -e "$RECIPIENTS_FILE" ]; then
+ cat "$RECIPIENTS_FILE"
+ else
+ echo "Recipients file not found: $RECIPIENTS_FILE_BASE"
+ exit 1
+ fi
+ else
+ for recipients in `ls $RECIPIENTS`; do
+ echo "In recipients file $recipients:"
+ echo "-----------------------------------------------------------------------------------"
+ cat $RECIPIENTS/$recipients
+ echo ""
+ done
+ fi
elif [ "$COMMAND" == "edit" ]; then
- "$EDITOR" "$RECIPIENTS"
- keyringer_check_recipients
+ if [ ! -z "$3" ]; then
+ keyringer_create_new_recipients $RECIPIENTS_FILE
+ "$EDITOR" "$RECIPIENTS_FILE"
+ keyringer_check_recipients
+ keyringer_exec git "$BASEDIR" add "$RECIPIENTS_FILE_BASE"
+ else
+ echo "Please specify one recipient to edit among the available:"
+ ls $RECIPIENTS | sed -e 's/^/\t/'
+ exit 1
+ fi
else
printf "%s: No such command %s\n" "$BASENAME" "$COMMAND"
exit 1
diff --git a/share/keyringer/recrypt b/share/keyringer/recrypt
index 438039d..cbf1af9 100755
--- a/share/keyringer/recrypt
+++ b/share/keyringer/recrypt
@@ -11,8 +11,11 @@ function keyringer_recrypt {
# Get file
keyringer_get_file "$1"
+ # Set recipients file
+ keyringer_set_recipients "$FILE"
+
# Recrypt
- $GPG --use-agent -d "$KEYDIR/$FILE" | $GPG --use-agent --armor -e -s $(keyringer_recipients "$RECIPIENTS") > "$KEYDIR/$FILE"
+ $GPG --use-agent -d "$KEYDIR/$FILE" | $GPG --use-agent --armor -e -s $(keyringer_recipients "$RECIPIENTS_FILE") > "$KEYDIR/$FILE"
if [ "$?" != "0" ]; then
exit 1