Skip to content

Instantly share code, notes, and snippets.

@martingaido
Last active August 14, 2020 16:54
Show Gist options
  • Save martingaido/894df8bdc7f5b7c6630b5d115a46d849 to your computer and use it in GitHub Desktop.
Save martingaido/894df8bdc7f5b7c6630b5d115a46d849 to your computer and use it in GitHub Desktop.
Bash script to encrypt and decrypt files using 'openssl'
# 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