home ホーム search 検索 -  login ログイン  | reload edit datainfo version cmd icon diff delete  | help ヘルプ

技術/Security/GnuPG

技術/Security/GnuPG

技術 / Security / GnuPG
id: 1031 所有者: msakamoto-sf    作成日: 2011-10-30 18:59:41
カテゴリ: セキュリティ 

GnuPGを使ってみたメモです。

少し古いですが参考にしました:

鍵の生成

gpg --gen-key

暗号化と復号化

暗号化 + 署名生成(受け取る相手が"UID"を想定):

gpg -se -r "UID" -o encrypted.dat plain.txt

「"UID"」の部分は、鍵を生成した時の"Real name", "Email address", "Comment"のどれか or フル指定。
例:

Real name: Foo Bar
Email address: foobar@example.com
Comment: mycomment
You selected this USER-ID:
    "Foo Bar (mycomment) <foobar@example.com>"

になるので、

"Foo Bar"

とか

"mycomment"

とか、厳密に一致させたい時は

"=Foo Bar (mycomment) <foobar@example.com>"

みたいに"UID"を指定できる。スペースが入って無ければダブルクォートで囲まなくとも平気かも。
UIDについての正確なドキュメントは下記参照:

復号化(署名検証は自動処理):

gpg encrypted.dat
gpg -o plain.txt encrypted.dat

鍵のインポート・エクスポート

PC1で生成した自分の公開鍵・秘密鍵をPC2に複製する:

公開鍵・秘密鍵のエキスポート

gpg -o public.key --export "UID"
gpg -o secret.key --export-secret-key "UID"
gpg --export-ownertrust > ownertrust.dat

公開鍵・秘密鍵のインポート

gpg --import public.key
gpg --import --allow-secret-key-import secret.key
gpg --import-ownertrust ownertrust.dat


プレーンテキスト形式でダウンロード
現在のバージョン : 1
更新者: msakamoto-sf
更新日: 2011-11-06 12:16:52
md5:b0ce625a0331b3a4448982d5044644fc
sha1:00da9cf76c1a1dc8ec470095a241ded053c8671c
コメント
コメントを投稿するにはログインして下さい。