2011-03-25

ccrypt を使ってみる

なんとなくファイルを暗号化したいと思っていろいろ調べたら ccrypt を発見したので使ってみる

ccrypt は弱い暗号を採用していた UNIX の crypt の代わりに作られたらしい
暗号はRijndael cipher だそうだ
この暗号は,アメリカのAESの候補となった暗号みたい
詳しくはhttp://ccrypt.sourceforge.net/を読んで下さい



元々入ってないので MacPorts からインストールした
sudo port install ccrypt
とりあえず,-h を付けて使い方を見てみる

ccrypt 1.9. Secure encryption and decryption of files and streams.
Usage: ccrypt [mode] [options] [file...]
       ccencrypt [options] [file...]
       ccdecrypt [options] [file...]
       ccat [options] file...
Modes:
    -e, --encrypt         encrypt
    -d, --decrypt         decrypt
    -c, --cat             cat; decrypt files to stdout
    -x, --keychange       change key
    -u, --unixcrypt       decrypt old unix crypt files
Options:
    -h, --help            print this help message and exit
    -V, --version         print version info and exit
    -L, --license         print license info and exit
    -v, --verbose         print progress information to stderr
    -q, --quiet           run quietly; suppress warnings
    -f, --force           overwrite existing files without asking
    -m, --mismatch        allow decryption with non-matching key
    -E, --envvar var      read keyword from environment variable (unsafe)
    -K, --key key         give keyword on command line (unsafe)
    -k, --keyfile file    read keyword(s) as first line(s) from file
    -P, --prompt prompt   use this prompt instead of default
    -S, --suffix .suf     use suffix .suf instead of default .cpt
    -s, --strictsuffix    refuse to encrypt files which already have suffix
    -F, --envvar2 var     as -E for second keyword (for keychange mode)
    -H, --key2 key        as -K for second keyword (for keychange mode)
    -Q, --prompt2 prompt  as -P for second keyword (for keychange mode)
    -t, --timid           prompt twice for encryption keys (default)
    -b, --brave           prompt only once for encryption keys
    -y, --keyref file     encryption key must match this encrypted file
    -r, --recursive       recurse through directories
    -R, --rec-symlinks    follow symbolic links as subdirectories
    -l, --symlinks        dereference symbolic links
    -T, --tmpfiles        use temporary files instead of overwriting (unsafe)
    --                    end of options, filenames follow

っとこんな感じです

基本的には暗号化は
ccrypt -e filename
で鍵(パスワード)を求められる
Enter encryption key:
Enter encryption key: (repeat)
そして暗号化されたファイルはfilename.cptとなる
復号は
ccrypt -d filename.cpt
で暗号化に使った鍵を求められる
Enter dencryption key:
復号が完了するとも元のファイル名に戻る

試しに
test cryption
と書いたテキストファイル(test.txt)を暗号化する
ccrypt -e test.txt
鍵は test で暗号化
暗号化された test.txt.cpt の中身は

√É g Í ‹ålÚ 6c-˝Ç
Ÿœ%ò¶«[ÃNÁ X‡Pπ®ƒPpCµûú K
と暗号化されていることがわかる

これからちょっと使ってみようかと思う
ついでにRijndael暗号についても調べてみる

0 件のコメント:

コメントを投稿