Last active
August 14, 2020 16:54
-
-
Save martingaido/894df8bdc7f5b7c6630b5d115a46d849 to your computer and use it in GitHub Desktop.
Bash script to encrypt and decrypt files using 'openssl'
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
# Install it in .bashrc file | |
function encrypt(){ | |
which openssl &> /dev/null | |
[ $? -ne 0 ] && echo "OPENSSL is not installed." && return 1 | |
openssl enc -aes-256-cbc -salt -in $1 -out $2 | |
} | |
function decrypt(){ | |
which openssl &> /dev/null | |
[ $? -ne 0 ] && echo "OPENSSL is not installed." && return 1 | |
openssl enc -aes-256-cbc -d -in $1 -out $2 | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment