diff options
-rw-r--r-- | README | 4 | ||||
-rwxr-xr-x | share/keyringer/recrypt | 20 |
2 files changed, 18 insertions, 6 deletions
@@ -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 |