openssl enc -aes-256-cbc -pbkdf2 -salt -in secret.txt -out secret.enc

Category: Security & Hardening

openssl enc -aes-256-cbc -pbkdf2 -salt -in secret.txt -out secret.enc

Encrypt a file with a passphrase

Encrypts secret.txt using AES-256-CBC with a passphrase you type, deriving the key with PBKDF2 and a random salt for stronger password stretching. Delete the original only after testing decryption. WARNING: losing the passphrase makes the file unrecoverable, since there is no backdoor.
Looking for more? Search all 7,657 commands — works offline, in English or Spanish, and fixes typos.