From 811486620cde2de4f022fe45d97d2397bb0a24a0 Mon Sep 17 00:00:00 2001 From: William Carroll Date: Fri, 15 Sep 2017 12:14:10 -0400 Subject: [PATCH] Updates GPG encryption/decryption convenience fns --- functions/gpg_functions.sh | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/functions/gpg_functions.sh b/functions/gpg_functions.sh index 267c40105..92762a5bd 100644 --- a/functions/gpg_functions.sh +++ b/functions/gpg_functions.sh @@ -1,5 +1,6 @@ #!/usr/bin/env zsh +# wip function gpg-encrypt-dir() { dirname=$1 echo "Encrypting..." @@ -8,6 +9,7 @@ function gpg-encrypt-dir() { } +# wip function gpg-decrypt-dir() { dirname=$1 outdir=${dirname%.tar.gz.gpg} @@ -24,19 +26,23 @@ function gpg-decrypt-dir() { } -# WIP +# encrypts a file, appending a .gpg extension +# deletes the non-encrypted source function gpg-encrypt-file() { filename=$1 - echo "Encrypting..." - gpg --symmetric $filename + echo "Encrypting..." && \ + gpg --symmetric ${filename} && \ + rm ${filename} && \ echo "Done." } -# WIP +# decrypts a file +# deletes the original encrypted file with the .gpg extension function gpg-decrypt-file() { filename=$1 - echo "Decrypting..." - gpg --decrypt $filename >"${filename%.gpg}" + echo "Decrypting..." && \ + gpg --decrypt ${filename} >"${filename%.gpg}" && \ + rm ${filename} && \ echo "Done." }