aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2009-10-08 16:47:03 -0300
committerSilvio Rhatto <rhatto@riseup.net>2009-10-08 16:47:03 -0300
commit62fa5fa2d2cf29d3761e060b49ee1490739c7b91 (patch)
tree1d3fb585b19765b7de94bb37ccd8ba39b069b1f8 /scripts
downloadkeyringer-62fa5fa2d2cf29d3761e060b49ee1490739c7b91.tar.gz
keyringer-62fa5fa2d2cf29d3761e060b49ee1490739c7b91.tar.bz2
Initial import
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/decrypt15
-rwxr-xr-xscripts/encrypt18
-rwxr-xr-xscripts/recrypt20
3 files changed, 53 insertions, 0 deletions
diff --git a/scripts/decrypt b/scripts/decrypt
new file mode 100755
index 0000000..a6fb8d5
--- /dev/null
+++ b/scripts/decrypt
@@ -0,0 +1,15 @@
+#!/bin/bash
+# decrypt
+
+FILE="$1"
+BASENAME="`basename $0`"
+
+if [ -z "$FILE" ]; then
+ echo "Usage: `basename $0` <file>"
+ exit 1
+elif [ ! -f "keys/$FILE" ]; then
+ echo "File not found"
+ exit 1
+fi
+
+gpg -d keys/$FILE
diff --git a/scripts/encrypt b/scripts/encrypt
new file mode 100755
index 0000000..107aa3e
--- /dev/null
+++ b/scripts/encrypt
@@ -0,0 +1,18 @@
+#!/bin/bash
+# encrypt to multiple recipients
+
+FILE="$1"
+BASENAME="`basename $0`"
+RECIPIENTS="config/recipients"
+
+if [ -z "$FILE" ]; then
+ echo "Usage: `basename $0` <file>"
+ exit 1
+elif [ ! -f "$RECIPIENTS" ]; then
+ echo "No recipient config was found"
+ exit 1
+fi
+
+mkdir -p keys/`dirname $FILE`
+recipients="$(awk '{ print "-r " $2 }' $RECIPIENTS | xargs)"
+gpg --armor -e -s $recipients - > keys/$FILE
diff --git a/scripts/recrypt b/scripts/recrypt
new file mode 100755
index 0000000..f2c8d6a
--- /dev/null
+++ b/scripts/recrypt
@@ -0,0 +1,20 @@
+#!/bin/bash
+# re-encrypt to multiple recipients
+
+FILE="$1"
+BASENAME="`basename $0`"
+RECIPIENTS="config/recipients"
+
+if [ -z "$FILE" ]; then
+ echo "Usage: `basename $0` <file>"
+ exit 1
+elif [ ! -f "$RECIPIENTS" ]; then
+ echo "No recipient config was found"
+ exit 1
+elif [ ! -f "keys/$FILE" ]; then
+ echo "File not found"
+ exit 1
+fi
+
+recipients="$(awk '{ print "-r " $2 }' $RECIPIENTS | xargs)"
+gpg -d keys/$FILE | gpg --armor -e -s $recipients > keys/$FILE