Create a file called secret.txt with sensitive data
echo "your secret message" > secret.txt
Encrypt the file using AES-256-CBC encryption
openssl enc -aes-256-cbc -salt -in secret.txt -out secret.encView the encrypted file to see it's unreadable
cat secret.enc to see the encrypted binary data
Decrypt the file back to plaintext
openssl enc -d -aes-256-cbc -in secret.enc -out decrypted.txtVerify the decrypted file matches the original
cat decrypted.txt to view the content
Try decrypting with the wrong password to see authentication failure
openssl enc -d -aes-256-cbc -in secret.enc -out failed.txtCompare AES-128 vs AES-256 by checking key length with openssl enc -aes-128-cbc -P
openssl enc -aes-128-cbc -P -pass pass:testopenssl enc -aes-256-cbc -P -pass pass:test