Updates GPG encryption/decryption convenience fns

This commit is contained in:
William Carroll 2017-09-15 12:14:10 -04:00
parent ed72f4a69d
commit 811486620c

View file

@ -1,5 +1,6 @@
#!/usr/bin/env zsh #!/usr/bin/env zsh
# wip
function gpg-encrypt-dir() { function gpg-encrypt-dir() {
dirname=$1 dirname=$1
echo "Encrypting..." echo "Encrypting..."
@ -8,6 +9,7 @@ function gpg-encrypt-dir() {
} }
# wip
function gpg-decrypt-dir() { function gpg-decrypt-dir() {
dirname=$1 dirname=$1
outdir=${dirname%.tar.gz.gpg} 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() { function gpg-encrypt-file() {
filename=$1 filename=$1
echo "Encrypting..." echo "Encrypting..." && \
gpg --symmetric $filename gpg --symmetric ${filename} && \
rm ${filename} && \
echo "Done." echo "Done."
} }
# WIP # decrypts a file
# deletes the original encrypted file with the .gpg extension
function gpg-decrypt-file() { function gpg-decrypt-file() {
filename=$1 filename=$1
echo "Decrypting..." echo "Decrypting..." && \
gpg --decrypt $filename >"${filename%.gpg}" gpg --decrypt ${filename} >"${filename%.gpg}" && \
rm ${filename} && \
echo "Done." echo "Done."
} }