共通鍵の場合のみ掲載。当然 OpenSSL は暗号化アルゴリズムによっては公開鍵も使えるが、ここには書いてないのでぐぐること。
暗号化する
% openssl enc -aes-128-cbc -e -in input.txt -out input.txt.crypt
enter aes-128-cbc encryption password:
Verifying - enter aes-128-cbc encryption password:
%
暗号化アルゴリズムは色々選べるが、OpenSSL コンパイル時のオプションによって異なる。
復号する
% openssl enc -aes-128-cbc -d -in input.txt.crypt -out input.txt
enter aes-128-cbc decryption password:
%
-out を省略してパイプしたりすることもできる。
(2009.05.03)