暗号化についても考えてみる
パスワードなんですが、今普通に見えます。レジストリエディタで開く、もしくはコンフィギュレーションファイルを表示すれば、生のパスワードが表示されます。
そのまま保存するのはマズイですよね。あまり大げさにしたくはないのですが、丸見えだと困ります。
UNIXな世界では、簡単な暗号化ならlibcryptというのがよく使われるそうです。
生のパスワードを引数で渡すと、暗号化した文字列を返してくれてたり、生のパスワードを引数で渡して、暗号化されて保存されている文字列と比較して正誤を判定してくれたりするライブラリというのが私のイメージです。
一から自分で作るよりは、このようなライブラリを利用したほうが楽で確実ですね。
libcryptは基本的にC言語用のライブラリです。今回はC++を使っているので、どうせならC++のライブラリの方がいいですよね。
C++用のフリーな暗号化ライブラリを公開されている方がいました。Debianとかでも採用されているようです。
Crypto++ というライブラリだそうです。
http://www.cryptopp.com/
早速ライセンスを調べますと、
「under the Boost Software License 1.0」
だそうです。
「Boost Software License 1.0」は以下にあります。
http://www.boost.org/LICENSE_1_0.txt
------------------------ ここから --------------------------------
Boost Software License - Version 1.0 - August 17th, 2003
Permission is hereby granted, free of charge, to any person or organization
obtaining a copy of the software and accompanying documentation covered by
this license (the "Software") to use, reproduce, display, distribute,
execute, and transmit the Software, and to prepare derivative works of the
Software, and to permit third-parties to whom the Software is furnished to
do so, all subject to the following:
The copyright notices in the Software and this entire statement, including
the above license grant, this restriction and the following disclaimer,
must be included in all copies of the Software, in whole or in part, and
all derivative works of the Software, unless such copies or derivative
works are solely in the form of machine-executable object code generated by
a source language processor.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
DEALINGS IN THE SOFTWARE.
------------------------ ここまで --------------------------------
参考のために日本語訳されている方がいました。
http://hamigaki.sourceforge.jp/doc/html/license.html
なんとなくですが、使えそうですね。Debianではパッケージとして提供されているので、そのまま使えそうですが、Windowsとかは同梱した方がよさそうですね…
とりあえず、ブックマークしておいて、今度調べましょう。
« Qt Designerを立ちあげてみる その4 | トップページ | 暗号化についても考えてみる その2 »
コメント