Quick Linux Tip #33:
Try: openssl enc -aes-256-cbc -pbkdf2 -in secrets.txt -out secrets.enc
Info: AES-256-CBC provides strong symmetric encryption. -pbkdf2 uses secure key derivation (automatically adding a salt) to prevent brute-force attacks.
Examples:
- $ openssl enc -d -aes-256-cbc -pbkdf2 -in secrets.enc -out secrets.txt # Decrypt
- $ tar -czf - /home/data | openssl enc -aes-256-cbc -pbkdf2 -out backup.tar.gz.enc
- $ gpg -c secrets.txt # Simpler alternative using GPG
Note: Always securely delete the plaintext original after encrypting (shred -u secrets.txt). Avoid passing passwords inline via command arguments as they appear in process history.
Leave a Reply