Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save andriitishchenko/67dec10883cd8bb6635ab43e4deab038 to your computer and use it in GitHub Desktop.
Save andriitishchenko/67dec10883cd8bb6635ab43e4deab038 to your computer and use it in GitHub Desktop.
openssl encryption and decryption | macOS

openssl encryption and decryption | macOS

from LibreSSL 2.9.1 the default message digest for openssl enc was changed from "md5" to "sha256"

For compatibility with macOS13+ and older, you must explicitly specify the parameter: -md sha256 or -md md5

Examples:

echo 'this is a test' | openssl enc -aes-256-cbc -a -A -md sha256 -pass file:<(echo 'mySecurePass')

echo 'this is a test' | openssl enc -aes-256-cbc -a -A -md sha256 -pass pass:mySecurePass

echo 'U2FsdGVkX1+bAFGWswmBkQ8bXTRtHNP1uJSnn7rlXtw=' | openssl enc -d -aes-256-cbc -a -A -md sha256 -pass file:<(echo 'mySecurePass')

echo 'U2FsdGVkX1+IjsKMenW0NsFZr+CUrqhhCWgY/5a2d/U=' | openssl enc -d -aes-256-cbc -a -A -md sha256 -pass pass:mySecurePass

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment