1 # -*- coding: utf-8-unix -*-
2 #+TITLE: edit-keyオプションの使い方
4 #+EMAIL: hideki@hidekisaito.com
5 #+DESCRIPTION: Emacs Builds prepared by Hideki Saito
6 #+KEYWORDS: Emacs, software, OSS, compile, build, binaries
8 #+HTML_HEAD: <link rel="stylesheet" type="text/css" href="style.css" />
9 #+HTML_HEAD: <script type="text/javascript">
11 #+HTML_HEAD: var _gaq = _gaq || [];
12 #+HTML_HEAD: _gaq.push(['_setAccount', 'UA-114515-7']);
13 #+HTML_HEAD: _gaq.push(['_trackPageview']);
15 #+HTML_HEAD: (function() {
16 #+HTML_HEAD: var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
17 #+HTML_HEAD: ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
18 #+HTML_HEAD: var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
20 #+HTML_HEAD: </script>
23 #+OPTIONS: H:3 num:nil toc:nil \n:nil @:t ::t |:t ^:t -:t f:t *:t <:t
24 #+OPTIONS: TeX:t LaTeX:t skip:nil d:nil todo:t pri:nil tags:not-in-toc
26 #+INFOJS_OPT: view:nil toc:nil ltoc:t mouse:underline buttons:0 path:h
27 #+EXPORT_SELECT_TAGS: export
28 #+EXPORT_EXCLUDE_TAGS: noexport
29 #+HTML_LINK_UP: index.html
30 #+HTML_LINK_HOME: index.html
34 GnuPGでは–edit-keyのオプションを使用して鍵(秘密鍵、または公開鍵)に対して変更を行ったり、情報を参照したりすることができます。 今回の特集ではそのオプション、特に鍵に変更を加えるものを見ていく事にします。 尚、このモードではコマンドラインから行う事ができる鍵への署名、破棄などをインタラクティブに行う事もできます。 (尚、これらは高度なオプションが含まれますので慎重に行う事をお勧めします。)
38 :ID: 535c3252-784d-4af8-b7a4-c106d35b3754
41 利用するのには以下のようにコマンドラインに入力します。
44 gpg --edit-key 0x565A5E2A
47 この時、秘密鍵を使用できる場合は「Secret key is available.」と表示されます。(日本語化がなされている場合は「秘密鍵が使用できます。」となりますが今回の説明では英語で表示された場合のものを表示します。
51 gpg --edit-key 0x565A5E2A
55 gpg (GnuPG) 1.2.3; Copyright (C) 2003 Free Software Foundation, Inc.
56 This program comes with ABSOLUTELY NO WARRANTY.
57 This is free software, and you are welcome to redistribute it
58 under certain conditions. See the file COPYING for details.
59 Secret key is available.
61 pub 1024D/565A5E2A created: 2003-12-07 expires: never trust: u/u
62 sub 2048g/E8D70F9E created: 2003-12-07 expires: never
64 (1). FooBar (Not a production key) [email protected]>
69 ここでhelpと入力すると以下のような表示が行われます。
77 list list key and user IDs
79 key select secondary key N
82 lsign sign the key locally
83 nrsign sign the key non-revocably
84 nrlsign sign the key locally and non-revocably
86 addphoto add a photo ID
88 addkey add a secondary key
89 delkey delete a secondary key
90 addrevoker add a revocation key
91 delsig delete signatures
92 expire change the expire date
93 primary flag user ID as primary
94 toggle toggle between secret and public key listing
95 pref list preferences (expert)
96 showpref list preferences (verbose)
97 setpref set preference list
98 updpref updated preferences
99 passwd change the passphrase
100 trust change the ownertrust
101 revsig revoke signatures
102 revuid revoke a user ID
103 revkey revoke a secondary key
104 disable disable a key
106 showphoto show photo ID
109 いろいろとオプションがありますが、これは日本語では以下のようになります。
124 nrlsign 失効できないよう鍵へ内部的に署名
134 toggle 秘密鍵と公開鍵の一覧の切替え
151 :ID: 106e8d50-e68d-4ee9-a362-293710fb27b4
153 showprefコマンドを使用する事により鍵の特性が表示されます。
158 pub 1024D/565A5E2A created: 2003-12-07 expires: never trust: u/u
159 (1). FooBar (Not a production key) [email protected]>
160 Cipher: AES256, AES192, AES, CAST5, 3DES
161 Digest: SHA1, RIPEMD160
162 Compression: ZLIB, ZIP, Uncompressed
166 上から暗号、署名、圧縮、機能に使用するアルゴリズムを表示します。 これは最初に表示されているものから優先して使用する事ができます。 尚、この順番を入れ替えたり、特定のアルゴリズムを使用しないようにすることもできます。 これをするのにはsetprefオプションを使用します。
170 prefコマンドを使用すると以下のような表示を得る事ができます。
175 pub 1024D/565A5E2A created: 2003-12-07 expires: never trust: u/u
176 (1). FooBar (Not a production key) [email protected]>
177 S9 S8 S7 S3 S2 H2 H3 Z2 Z1 [mdc]
180 setprefコマンドと表示されているスタイルの指定をすることによりそれを指定する事ができます。 つまり、例えば3DESを使用したくない場合は、以下のように指定します。(厳密には3DESを無効にしても他に使用できるものが見つからない場合はこの設定を無視して3DESによる暗号化が行われます。これは3DESがOpenPGPで必須のアルゴリズムとされているためです。)
183 setpref S9 S8 S7 S3 H2 H3 Z2 Z1
186 この時点ではこの変更は行われていません。 次に以下のコマンドを入力します。
197 Current preference list: S9 S8 S7 S3 H2 H3 Z2 Z1 [mdc]
198 Really update the preferences?
201 ここでyを入力するとsetprefで行った変更を行うためにパスフレーズの入力を要求します。 そして、saveと入力してedit-keyモードから抜けると変更が有効になります。
205 :ID: 01049cbb-d54d-44a2-83b4-576928979235
207 expireコマンドではその有効期限を変更する事ができます。 expireコマンドの実行で以下のような設定をすることができます。
212 Changing expiration time for the primary key.
213 Please specify how long the key should be valid.
214 0 = key does not expire
215 = key expires in n days
216 w = key expires in n weeks
217 m = key expires in n months
218 y = key expires in n years
220 Key is valid for? (0)
224 指定は0で無期限もしくは数字で日数、またはその後に、w、m、yの単位を入力することにより週、月、年の単位で指定する事ができます。 例えば1yと入力する事により一年間有効にする事ができます。
228 :ID: eabbae3b-1375-4eb5-b871-91f1f174f5a7
231 指定した鍵に複数の副鍵がある場合は少し特殊な操作が必要にある必要があります。 副鍵がある場合、鍵を表示すると以下のような表示になります。
235 pub 1024D/514D0EF4 created: 2003-12-08 expires: never trust: u/u
236 sub 1024g/88480126 created: 2003-12-08 expires: never
237 sub 1024R/E5FFF9CD created: 2003-12-08 expires: never
238 (1). FooBar (Not for a production use)
241 普通に鍵の変更をしようとすると主鍵の変更となります。 どの鍵に対して変更をしようとしているかはコマンドを使用する時の表示で判別することができます。
245 :ID: 10a58fb6-7425-4e32-8bc8-c573b7470822
251 Changing expiration time for the primary key.
252 Please specify how long the key should be valid.
254 0 = key does not expire
255 = key expires in n days
256 w = key expires in n weeks
257 m = key expires in n months
258 y = key expires in n years
260 Key is valid for? (0)
263 上記の表示のように、”~ for the primary key.”という表示で主鍵に変更を加えようとしていることがわかります。
264 副鍵に変更を加えるにはkeyコマンドを使用します。
267 gpg --edit-key foobar
271 gpg (GnuPG) 1.2.3; Copyright (C) 2003 Free Software Foundation, Inc.
273 This program comes with ABSOLUTELY NO WARRANTY.
274 This is free software, and you are welcome to redistribute it
275 under certain conditions. See the file COPYING for details.
276 Secret key is available.
278 pub 1024D/514D0EF4 created: 2003-12-08 expires: never trust: u/u
279 sub 1024g/88480126 created: 2003-12-08 expires: never
280 sub 1024R/E5FFF9CD created: 2003-12-08 expires: 2003-12-09
282 (1). FooBar (Not for a production use)
286 pub 1024D/514D0EF4 created: 2003-12-08 expires: never trust: u/u
287 sub 1024g/88480126 created: 2003-12-08 expires: never
288 sub* 1024R/E5FFF9CD created: 2003-12-08 expires: 2003-12-09
290 (1). FooBar (Not for a production use)
293 ここで打ち込んだkey 2のコマンドによってE5FFF9CDの鍵に*マークがついたのがわかると思います。 これにより今行う変更はこの副鍵に対して行われます。これは複数の鍵を選択する事も可能でこの場合は以下のようになります。
300 gpg (GnuPG) 1.2.3; Copyright (C) 2003 Free Software Foundation, Inc.
301 This program comes with ABSOLUTELY NO WARRANTY.
302 This is free software, and you are welcome to redistribute it
303 under certain conditions. See the file COPYING for details.
304 Secret key is available.
306 pub 1024D/514D0EF4 created: 2003-12-08 expires: never trust: u/u
307 sub 1024g/88480126 created: 2003-12-08 expires: never
308 sub 1024R/E5FFF9CD created: 2003-12-08 expires: 2003-12-09
309 sub 1024R/9A8AA276 created: 2003-12-10 expires: never
311 (1). FooBar (Not for a production use)
315 pub 1024D/514D0EF4 created: 2003-12-08 expires: never trust: u/u
316 sub 1024g/88480126 created: 2003-12-08 expires: never
317 sub* 1024R/E5FFF9CD created: 2003-12-08 expires: 2003-12-09
318 sub 1024R/9A8AA276 created: 2003-12-10 expires: never
320 (1). FooBar (Not for a production use)
324 pub 1024D/514D0EF4 created: 2003-12-08 expires: never trust: u/u
325 sub 1024g/88480126 created: 2003-12-08 expires: never
326 sub* 1024R/E5FFF9CD created: 2003-12-08 expires: 2003-12-09
327 sub* 1024R/9A8AA276 created: 2003-12-10 expires: never
329 (1). FooBar (Not for a production use)
332 expireなどの一定のコマンドは一つの鍵のみが選択されている必要があります。
335 <script type="text/javascript"><!--
336 google_ad_client = "ca-pub-6327257212970697";
337 /* GNU Privacy Guard講座Banner */
338 google_ad_slot = "2155169100";
339 google_ad_width = 970;
340 google_ad_height = 90;
343 <script type="text/javascript"
344 src="http://pagead2.googlesyndication.com/pagead/show_ads.js">