Issuer Fingerprint Signature Subpacket in Next OpenPGP
「OpenPGP 鍵管理に関する考察」を書いていて気づいたのだが,署名パケット(signature packet)に関して,次期 OpenPGP (RFC 4880bis) の実装が既に GnuPG に一部入っているようである1。
署名パケットの中に署名サブパケット(signature subpacket; 鍵や署名に関する属性情報が入っている)というのがあって RFC 4880 では sub 32 まで ID が振られているのだけど(プライベート用は別), RFC 4880bis で sub 33 が追加された。 それが “Issuer Fingerprint” で以下の内容になっている。
The OpenPGP Key fingerprint of the key issuing the signature. This subpacket SHOULD be included in all signatures. If the version of the issuing key is 4 and an Issuer subpacket is also included in the signature, the key ID of the Issuer subpacket MUST match the low 64 bits of the fingerprint.
Note that the length N of the fingerprint for a version 4 key is 20 octets; for a version 5 key N is 32.
まぁ,要するに “Issuer Fingerprint” には署名を行う鍵の鍵指紋(key fingerprint)が入りますよ,ということのようだ。 ちょっと試してみよう。
たとえば “Hello world” の文字列に電子署名してみる。
$ echo Hello world | gpg -u 0x7E20B81C --clear-sign
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA256
Hello world
-----BEGIN PGP SIGNATURE-----
iHUEAREIAB0WIQQbUgLbSj7HdvHgrRi02juufiC4HAUCWhfcngAKCRC02juufiC4
HCPUAP4npfesVUOXy/RbFn65Ci6rgtvrFNeNIfmFjYit/xMEywD/eHflgDJQWY+Y
7g7btse2kmbJvRwaKUf1QMgntzgo07E=
=k8ok
-----END PGP SIGNATURE-----
ちなみに 0x7E20B81C
は私の鍵の鍵 ID である。
--clear-sign
コマンドは署名対象のテキストとその電子署名を ASCII armor で出力する。
これをそのまま pgpdump にかけてみよう。
こんな感じになる。
$ echo Hello world | gpg -u 0x7E20B81C --clear-sign | pgpdump -u
Old: Signature Packet(tag 2)(117 bytes)
Ver 4 - new
Sig type - Signature of a canonical text document(0x01).
Pub alg - DSA Digital Signature Algorithm(pub 17)
Hash alg - SHA256(hash 8)
Hashed Sub: issuer fingerprint(sub 33)(21 bytes)
v4 - Fingerprint - 1b 52 02 db 4a 3e c7 76 f1 e0 ad 18 b4 da 3b ae 7e 20 b8 1c
Hashed Sub: signature creation time(sub 2)(4 bytes)
Time - Fri Nov 24 08:56:21 UTC 2017
Sub: issuer key ID(sub 16)(8 bytes)
Key ID - 0xB4DA3BAE7E20B81C
Hash left 2 bytes - 23 54
DSA r(255 bits) - ...
DSA s(256 bits) - ...
-> hash(DSA q bits)
なお pgpdump はバージョン 0.32 で “Issuer Fingerprint” に対応した2。
RFC 4880bis では V5 フォーマットの公開鍵パケットや鍵指紋3 の仕様が出てきている。 これらの仕様を取り込んだ GnuPG 2.3 あたりがそのうち出てくるんじゃないかと期待している。
ブックマーク
参考図書
- 暗号技術入門 第3版 秘密の国のアリス
- 結城 浩 (著)
- SBクリエイティブ 2015-08-25 (Release 2015-09-17)
- Kindle版
- B015643CPE (ASIN)
- 評価
SHA-3 や Bitcoin/Blockchain など新しい知見や技術要素を大幅追加。暗号技術を使うだけならこれ1冊でとりあえず無問題。