summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2011-05-27 10:26:10 -0300
committerSilvio Rhatto <rhatto@riseup.net>2011-05-27 10:26:10 -0300
commit733df1aa85e7cc0ccd23624c071387617053f049 (patch)
treec3397283f59d3cd09368cef903c449d0029e0c65
parent56cc3ab078158f596d0cd4fc5152e113e58fc6f7 (diff)
downloadkeyringer-733df1aa85e7cc0ccd23624c071387617053f049.tar.gz
keyringer-733df1aa85e7cc0ccd23624c071387617053f049.tar.bz2
Action recrypt now can re-encrypt the whole repository
-rw-r--r--README4
-rwxr-xr-xshare/keyringer/recrypt20
2 files changed, 18 insertions, 6 deletions
diff --git a/README b/README
index 792e64e..534044e 100644
--- a/README
+++ b/README
@@ -88,9 +88,9 @@ Decrypting a key (only to stdout)
keyringer <keyring> decrypt <file>
-Re-encrypting a key
+Re-encrypting a key or the whole repository
- keyringer <keyring> recrypt <file>
+ keyringer <keyring> recrypt [file]
Appending information to a key
diff --git a/share/keyringer/recrypt b/share/keyringer/recrypt
index a7607e0..f4cc9de 100755
--- a/share/keyringer/recrypt
+++ b/share/keyringer/recrypt
@@ -7,8 +7,20 @@
LIB="`dirname $0`/../../lib/keyringer/functions"
source "$LIB" || exit 1
-# Get file
-keyringer_get_file "$2"
+function keyringer_recrypt {
+ # Get file
+ keyringer_get_file "$1"
-# Recrypt
-gpg --use-agent -d "$KEYDIR/$FILE" | gpg --use-agent --armor -e -s $(keyringer_recipients "$RECIPIENTS") > "$KEYDIR/$FILE"
+ # Recrypt
+ gpg --use-agent -d "$KEYDIR/$FILE" | gpg --use-agent --armor -e -s $(keyringer_recipients "$RECIPIENTS") > "$KEYDIR/$FILE"
+}
+
+if [ ! -z "$2" ]; then
+ keyringer_recrypt $2
+else
+ cd $KEYDIR && find | grep -v '^.$' | while read file; do
+ if [ ! -d "$KEYDIR/$file" ]; then
+ keyringer_recrypt "$file"
+ fi
+ done
+fi