Skip to content

Instantly share code, notes, and snippets.

@arnauldvm
Last active March 13, 2019 15:41
Show Gist options
  • Save arnauldvm/45d37f54036230e4951827b4a649e4b0 to your computer and use it in GitHub Desktop.
Save arnauldvm/45d37f54036230e4951827b4a649e4b0 to your computer and use it in GitHub Desktop.
Symmetric encryption using openssl
openssl rand 16 | base64 > temp_key
echo "Data to be encrypted" | openssl aes-256-cbc -pass file:temp_key > data.encrypted
# Send the file "data.encrypted"
# Send the temp_key (if possible, encrypted with the public key of the recipient)
# Recipient side:
openssl aes-256-cbc -d -in data.encrypted -pass file:temp_key
# See also: https://bjornjohansen.no/encrypt-file-using-ssh-key
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment