opensslコマンドでファイルを暗号化

file.datを暗号化してfile.dat.encryptedを出力する。鍵は./passwordとする。

$ openssl aes-256-cbc -e -in file.dat -out file.dat.encrypted -pass file:./password

脆弱性があるのでaes-256-ecbは使ってはダメ。aes-256-cbcを使うこと。

復号化する際は、

$ openssl aes-256-cbc -d -in file.dat.encrypted -out file.dat -pass file:./password

とする。