Skip to content

Instantly share code, notes, and snippets.

@receptor
Created November 23, 2018 15:39
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save receptor/c9e53d255877758ce510c4899a986a33 to your computer and use it in GitHub Desktop.
Save receptor/c9e53d255877758ce510c4899a986a33 to your computer and use it in GitHub Desktop.
OpenSSL encrypt & decrypt one-liners
ENCRYPT
$ echo "my secret message" | openssl aes-256-cbc -a -salt
enter aes-256-cbc encryption password:
Verifying - enter aes-256-cbc encryption password:
U2FsdGVkX19T5h74/9HOtWBX4WoIggVKksYf7L1WBso=
DECRYPT
$ echo "U2FsdGVkX19T5h74/9HOtWBX4WoIggVKksYf7L1WBso=" | openssl aes-256-cbc -a -d -salt
enter aes-256-cbc decryption password:
my secret message
NON-INTERACTIVE
$ echo "sensitive data" | openssl aes-256-cbc -a -salt -pass pass:secret > ./store
$ cat ./store | openssl aes-256-cbc -a -d -salt -pass pass:secret
sensitive data
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment