Skip to content

Instantly share code, notes, and snippets.

@corvax19
Last active July 28, 2023 14:10
Show Gist options
  • Star 33 You must be signed in to star a gist
  • Fork 7 You must be signed in to fork a gist
  • Save corvax19/4275922 to your computer and use it in GitHub Desktop.
Save corvax19/4275922 to your computer and use it in GitHub Desktop.
[/linux/openSSL] Simple text #encryption/#decryption with #openssl
echo -n "That's the text"|openssl enc -e -aes-256-cbc -a
Encrypt with interactive password. Encrypted message is base64-encoded afterwards.
echo -n "That's the text"|openssl enc -e -aes-256-cbc -a -k "MySuperPassword"
Encrypt with specified password. Encrypted message is base64-encoded afterwards.
echo "GVkYiq1b4M/8ZansBC3Jwx/UtGZzlxJPpygyC"|openssl base64 -d|openssl enc -d -aes-256-cbc
Base-64 decode and decrypt message with interactive password.
echo "GVkYiq1b4M/8ZansBC3Jwx/UtGZzlxJPpygyC"|openssl base64 -d|openssl enc -d -aes-256-cbc -k "MySuperPassword"
Base-64 decode and decrypt message with specified password.
@JoshMcCullough
Copy link

JoshMcCullough commented Mar 13, 2020

Your decoding examples don't include -a so wouldn't Base64 decode the input string, right? Also worth noting that you should now include the password key function and iteration count as well, e.g. openssl enc -e -aes-256-cbc -pbkdf2 -iter 1234 -a -k <password>

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