Last active
November 9, 2019 22:37
-
-
Save ryu1kn/e435b2ea79edba2798ab5048834dd0e0 to your computer and use it in GitHub Desktop.
Encrypt/decrypt a directory using GPG with symmetric key option
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Encrypt/decrypt a directory using GPG with symmetric key option | |
dir_name := plain-files | |
encrypted_file := encrypted-dir.blob | |
tmp_file := tmp.tgz | |
encrypt-dir: | |
tar czf $(tmp_file) $(dir_name) | |
gpg --no-symkey-cache -o $(encrypted_file) -c $(tmp_file) | |
rm -f $(tmp_file) | |
decrypt-dir: | |
gpg -o $(tmp_file) -d $(encrypted_file) | |
tar xzf $(tmp_file) | |
rm -f $(tmp_file) | |
encrypt-string: | |
echo "MY TOP SECRET" | gpg --symmetric --armor --passphrase "$(MY_PASSWORD)" > encrypted.txt | |
decrypt-string: | |
cat encrypted.txt | gpg |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment