Created
December 12, 2021 09:51
-
-
Save adrienjoly/ff3a9bea111c5487882a7ba327c5a03b to your computer and use it in GitHub Desktop.
Commands to archive, encrypt and decrypt secret files using gpg's symmetric encryption.
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
TAR_FILE="secret-archive.tgz" | |
DEST_FILE="crypted-secret-archive.tgz.gpg" | |
# Archive | |
tar cvzf "${TAR_FILE}" ${SECRET_FILES_PATH}/* | |
# Encrypt | |
echo "${GPG_PASSPHRASE}" | gpg --batch --yes --passphrase-fd 0 -o "${DEST_FILE}" --symmetric "${TAR_FILE}" | |
# Decrypt | |
echo "${GPG_PASSPHRASE}" | gpg --batch --yes --passphrase-fd 0 --decrypt "${DEST_FILE}" > "${DECRYPTED_FILE}" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment