# brew openssl
# openssl_ -> /usr/local/Cellar/openssl/1.0.2e_1/bin/openssl
export OSSL=/usr/local/opt/openssl/bin/openssl

#openssl
alias ossl=$OSSL
alias sha="$OSSL sha1"
alias sha256="$OSSL dgst -sha256"
alias sha512="$OSSL dgst -sha512"
alias b64="$OSSL enc -base64 -e"
alias b64dec="$OSSL enc -base64 -d"
alias ciphers="$OSSL list-cipher-commands"


###   ###   ###   ###     ###
###  AES Encrypt/Decrypt    #

alias aes="$OSSL enc -aes-256-cbc"

# encrypt file.txt to file.enc using 256-bit AES in CBC mode
#openssl enc -aes-256-cbc -salt -in file.txt -out file.enc
# the same, only the output is base64 encoded for, e.g., e-mail
#openssl enc -aes-256-cbc -a -salt -in file.txt -out file.enc
# decrypt binary file.enc
#openssl enc -d -aes-256-cbc -in file.enc
# decrypt base64-encoded version
#openssl enc -d -aes-256-cbc -a -in file.enc
# provide password on command line
#openssl enc -aes-256-cbc -salt -in file.txt -out file.enc -pass pass:mySillyPassword
# provide password in a file
#openssl enc -aes-256-cbc -salt -in file.txt -out file.enc -pass file:/path/to/secret/password.txt



###   ###   ###   ###     ###
###  Brew OpenSSL           #

# A CA file has been bootstrapped using certificates from the system
# keychain. To add additional certificates, place .pem files in
#   /usr/local/etc/openssl/certs

# and run
#   /usr/local/opt/openssl/bin/c_rehash
