aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-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