Page: 1 メールの暗号化 とみたまさひろ NSEG #40 2013/06/08 メールの暗号化 Powered by Rabbit 2.0.9 Page: 2 自己紹介 とみた まさひろ プログラマー (Ruby & C) http://d.hatena.ne.jp/tmtms http://twitter.com/tmtms 好きなもの Ruby, MySQL, Linux Mint, Emacs, Git メールの暗号化 Powered by Rabbit 2.0.9
本日は、 Ruby の OpenSSL バインドを利用してデータを暗号化する方法をご紹介します。というのも最近、自宅サーバーにある各種データを Web 上のサービスに移動しようと画策していまして、その際にプライベートなデータは暗号化して保存したいのです。ほとんどの Web API は暗号化なしの HTTP で通信しますし、いくらパスワードで保護されているとはいえ、他所の HDD にプレーンな状態で保存するのは不安ですからね。 それ以外でもスクリプトで暗号化の処理をしたい場面はいろいろあると思います。そんなときは、ぜひ参考にしてください。 それでは、まずは暗号化の処理から。 OpenSSL はさまざまな暗号化アルゴリズムをサポートしていますが、ここではリファレンスでも推奨されている AES-256-CBC を使うことにします。ひとつの文字列(バイト列)を暗号化する関数は以下のようになります。
リリース、障害情報などのサービスのお知らせ
最新の人気エントリーの配信
処理を実行中です
j次のブックマーク
k前のブックマーク
lあとで読む
eコメント一覧を開く
oページを開く