Skip to content

Instantly share code, notes, and snippets.

@FATESAIKOU
Created August 12, 2024 06:27
Show Gist options
  • Save FATESAIKOU/eec7cec784717134558e6dc1aa8f5f7b to your computer and use it in GitHub Desktop.
Save FATESAIKOU/eec7cec784717134558e6dc1aa8f5f7b to your computer and use it in GitHub Desktop.
Encrypt and Decrypt with openssl
#!/usr/bin/env bash
PASSWORD=$1
# encryption
echo "Hello, world!" | openssl enc -aes-256-cbc -pbkdf2 -iter 10000 -a -salt -pass pass:"$PASSWORD" > helloWorld.crypted
# decryption
cat helloWorld.crypted | openssl enc -d -aes-256-cbc -pbkdf2 -iter 10000 -a -pass pass:"$PASSWORD" # Output "Hello, world!" here
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment