Re: [dane] Start of WGLC for draft-ietf-dane-openpgpkey: objection about keyring format documentation

Petr Spacek <pspacek@redhat.com> Tue, 17 March 2015 20:11 UTC

Return-Path: <pspacek@redhat.com>
X-Original-To: dane@ietfa.amsl.com
Delivered-To: dane@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 94A741A88E8 for <dane@ietfa.amsl.com>; Tue, 17 Mar 2015 13:11:46 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -6.912
X-Spam-Level:
X-Spam-Status: No, score=-6.912 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_HI=-5, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001, T_RP_MATCHES_RCVD=-0.01] autolearn=ham
Received: from mail.ietf.org ([4.31.198.44]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id omT7hAB90gXB for <dane@ietfa.amsl.com>; Tue, 17 Mar 2015 13:11:44 -0700 (PDT)
Received: from mx1.redhat.com (mx1.redhat.com [209.132.183.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 408131A88E7 for <dane@ietf.org>; Tue, 17 Mar 2015 13:11:41 -0700 (PDT)
Received: from int-mx13.intmail.prod.int.phx2.redhat.com (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id t2HKBeDj022182 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL) for <dane@ietf.org>; Tue, 17 Mar 2015 16:11:40 -0400
Received: from pspacek.brq.redhat.com ([10.40.204.43]) by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t2HKBbYv021577 (version=TLSv1/SSLv3 cipher=AES256-SHA bits=256 verify=NO) for <dane@ietf.org>; Tue, 17 Mar 2015 16:11:39 -0400
Message-ID: <55088A79.8070201@redhat.com>
Date: Tue, 17 Mar 2015 21:11:37 +0100
From: Petr Spacek <pspacek@redhat.com>
Organization: Red Hat
User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.5.0
MIME-Version: 1.0
To: dane@ietf.org
References: <CAHw9_iJPuG23Aok7V_wcAMirua_DPDLHy01tnd+DaUqEeK3NZA@mail.gmail.com> <54EF3A7D.6070809@redhat.com> <8CB4E1AD-35C6-4A92-97ED-CC2853C2896C@vpnc.org> <alpine.LFD.2.10.1503082309420.31060@bofh.nohats.ca>
In-Reply-To: <alpine.LFD.2.10.1503082309420.31060@bofh.nohats.ca>
Content-Type: text/plain; charset="windows-1252"
Content-Transfer-Encoding: 7bit
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26
Archived-At: <http://mailarchive.ietf.org/arch/msg/dane/ytRhjcW-9nAKLX0nhWEQxOl4VgM>
Subject: Re: [dane] Start of WGLC for draft-ietf-dane-openpgpkey: objection about keyring format documentation
X-BeenThere: dane@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: DNS-based Authentication of Named Entities <dane.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/dane>, <mailto:dane-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/dane/>
List-Post: <mailto:dane@ietf.org>
List-Help: <mailto:dane-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/dane>, <mailto:dane-request@ietf.org?subject=subscribe>
X-List-Received-Date: Tue, 17 Mar 2015 20:11:46 -0000

Hello!

I'm sorry for being very late, I had to do some $DAILYJOB.

First of all, thank you for incorporating the feedback!

On 9.3.2015 04:10, Paul Wouters wrote:
> On Sun, 8 Mar 2015, Paul Hoffman wrote:
> 
>> Proposal: this draft should specify that the contents of the RDATA is a
>> single public key, defined in Section 5.5.1.1 of RFC 4880. Are there common
>> cases where this is not sufficient?
> 
> I'm okay with that. Will put into the -02 version.

Finally I had some time to review -02 version of the text and I think that it
would deserve some more attention:

Currently we have:

> 2.2. The OPENPGPKEY RDATA wire format
>    The RDATA Wire Format consists of a single OpenPGP public key as
>    defined in Section 5.5.1.1 of [RFC4880].  Note that this format is
>    without ASCII armor or base64 encoding.

http://tools.ietf.org/html/rfc4880#section-5.5.1.1 says:
> 5.5.1.1. Public-Key Packet (Tag 6)
>    A Public-Key packet starts a series of packets that forms an OpenPGP
>    key (sometimes called an OpenPGP certificate).

Well, formulation 'starts a series of packets that forms an OpenPGP key' is
not very informative and contradicts Paul's assumption about 'single public
key' mentioned above. Series of what?

Let's see what OpenPGP 1.4.19 exports. It is sequence of:
:public key packet:
:user ID packet:
:signature packet:
:public sub key packet:
:signature packet:

which is pretty convoluted sequence of packets.

Also, http://tools.ietf.org/html/rfc4880#section-5.5.1.2 says this:
> ... By convention, the top-level key
>    provides signature services, and the subkeys provide encryption
>    services.

Blindly using top-level key from first public key packet would violate crypto
protocol enforced by PGP (and doing so could have undesired effects as you
should never ever use one key to do encryption/decryption and signing...).

I would say that for the purpose of OPENPGPKEY we do not need user IDs
because, after all, we are going to use DNS for user id -> key mapping.

The next problem is that by stripping all the 'signature' packets we would
lose preferences like preferred hashing algorithms, key flags etc. which are
stored in signature packet.

Also, I would like to see clarification to the actual rdata encoding.


Having said all that, I would like to discuss this variant of section 2.2:

2.2. The OPENPGPKEY RDATA wire format

The RDATA Wire Format consists of a single OpenPGP public-subkey packet as
defined in Section 5.5.1.2 of [RFC4880]. The rdata MUST NOT contain any other
packets. Tools generating rdata must respect Key Flags as specified in section
5.2.3.21 of [RFC4880] and export only keys with flags appropriate for e-mail
encryption communication.

Rdata MUST be encoded according to Section 4 of [RFC4880], including the full
packet header. Note that this format is without ASCII armor or base64 encoding.


The open question is if really should strip all the signature packets as it
discards all the keyflags, algorithm preferences etc.

I'm attaching output from pgpdump below so you can see what information is in
which packets of typical public key export. For pure encryption we need only
Public Subkey Packet (tag 14) and nothing else.


Old: Public Key Packet(tag 6)(269 bytes)
	Ver 4 - new
	Public key creation time - Fri Feb 15 09:25:33 CET 2013
	Pub alg - RSA Encrypt or Sign(pub 1)
	RSA n(2048 bits) - ...
	RSA e(17 bits) - ...
Old: User ID Packet(tag 13)(32 bytes)
	User ID - Petr Spacek <pspacek@redhat.com>
Old: Signature Packet(tag 2)(318 bytes)
	Ver 4 - new
	Sig type - Positive certification of a User ID and Public Key packet(0x13).
	Pub alg - RSA Encrypt or Sign(pub 1)
	Hash alg - SHA1(hash 2)
	Hashed Sub: signature creation time(sub 2)(4 bytes)
		Time - Fri Feb 15 09:25:33 CET 2013
	Hashed Sub: key flags(sub 27)(1 bytes)
		Flag - This key may be used to certify other keys
		Flag - This key may be used to sign data
	Hashed Sub: key expiration time(sub 9)(4 bytes)
		Time - Sun Mar 17 09:25:33 CET 2013
	Hashed Sub: preferred symmetric algorithms(sub 11)(5 bytes)
		Sym alg - AES with 256-bit key(sym 9)
		Sym alg - AES with 192-bit key(sym 8)
		Sym alg - AES with 128-bit key(sym 7)
		Sym alg - CAST5(sym 3)
		Sym alg - Triple-DES(sym 2)
	Hashed Sub: preferred hash algorithms(sub 21)(5 bytes)
		Hash alg - SHA256(hash 8)
		Hash alg - SHA1(hash 2)
		Hash alg - SHA384(hash 9)
		Hash alg - SHA512(hash 10)
		Hash alg - SHA224(hash 11)
	Hashed Sub: preferred compression algorithms(sub 22)(3 bytes)
		Comp alg - ZLIB <RFC1950>(comp 2)
		Comp alg - BZip2(comp 3)
		Comp alg - ZIP <RFC1951>(comp 1)
	Hashed Sub: features(sub 30)(1 bytes)
		Flag - Modification detection (packets 18 and 19)
	Hashed Sub: key server preferences(sub 23)(1 bytes)
		Flag - No-modify
	Sub: issuer key ID(sub 16)(8 bytes)
		Key ID - 0x3F8A1B3A9A7C8D08
	Hash left 2 bytes - 27 b1
	RSA m^d mod n(2048 bits) - ...
		-> PKCS-1
Old: Public Subkey Packet(tag 14)(269 bytes)
	Ver 4 - new
	Public key creation time - Fri Feb 15 09:25:33 CET 2013
	Pub alg - RSA Encrypt or Sign(pub 1)
	RSA n(2048 bits) - ...
	RSA e(17 bits) - ...
Old: Signature Packet(tag 2)(293 bytes)
	Ver 4 - new
	Sig type - Subkey Binding Signature(0x18).
	Pub alg - RSA Encrypt or Sign(pub 1)
	Hash alg - SHA1(hash 2)
	Hashed Sub: signature creation time(sub 2)(4 bytes)
		Time - Fri Feb 15 09:25:33 CET 2013
	Hashed Sub: key flags(sub 27)(1 bytes)
		Flag - This key may be used to encrypt communications
		Flag - This key may be used to encrypt storage
	Hashed Sub: key expiration time(sub 9)(4 bytes)
		Time - Sun Mar 17 09:25:33 CET 2013
	Sub: issuer key ID(sub 16)(8 bytes)
		Key ID - 0x3F8A1B3A9A7C8D08
	Hash left 2 bytes - 0f f1
	RSA m^d mod n(2047 bits) - ...
		-> PKCS-1

-- 
Petr Spacek  @  Red Hat