Re: [openpgp] ECC point encoding and "flag byte"

Ángel <angel@16bits.net> Fri, 05 March 2021 00:14 UTC

Return-Path: <angel@16bits.net>
X-Original-To: openpgp@ietfa.amsl.com
Delivered-To: openpgp@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id C368D3A19F9 for <openpgp@ietfa.amsl.com>; Thu, 4 Mar 2021 16:14:17 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.9
X-Spam-Level:
X-Spam-Status: No, score=-1.9 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_BLOCKED=0.001, SPF_PASS=-0.001] autolearn=ham autolearn_force=no
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 8pipi69NilcD for <openpgp@ietfa.amsl.com>; Thu, 4 Mar 2021 16:14:16 -0800 (PST)
Received: from mail.direccionemail.com (mail.direccionemail.com [199.195.249.9]) (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 E3A733A19F3 for <openpgp@ietf.org>; Thu, 4 Mar 2021 16:14:15 -0800 (PST)
Message-ID: <7dda8b9e31616bf84d409c33e4eeef79f366143f.camel@16bits.net>
From: Ángel <angel@16bits.net>
To: openpgp@ietf.org
Date: Fri, 05 Mar 2021 01:14:11 +0100
In-Reply-To: <87v9a75oj3.fsf@wheatstone.g10code.de>
References: <87h7lyccns.fsf@fifthhorseman.net> <87czwj8d3b.fsf@wheatstone.g10code.de> <87v9a829z7.fsf@iwagami.gniibe.org> <e41505a7f57175dd18f45cf7c1e8c2f7ea63458d.camel@16bits.net> <87v9a75oj3.fsf@wheatstone.g10code.de>
Content-Type: text/plain; charset="ISO-8859-15"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
Archived-At: <https://mailarchive.ietf.org/arch/msg/openpgp/kTGuadF81AFVhReKzIDWGFq_8_w>
Subject: Re: [openpgp] ECC point encoding and "flag byte"
X-BeenThere: openpgp@ietf.org
X-Mailman-Version: 2.1.29
Precedence: list
List-Id: "Ongoing discussion of OpenPGP issues." <openpgp.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/openpgp>, <mailto:openpgp-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/openpgp/>
List-Post: <mailto:openpgp@ietf.org>
List-Help: <mailto:openpgp-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/openpgp>, <mailto:openpgp-request@ietf.org?subject=subscribe>
X-List-Received-Date: Fri, 05 Mar 2021 00:14:18 -0000

On 2021-03-04 at 09:08 +0100, Werner Koch wrote:
> On Wed,  3 Mar 2021 23:38, Ángel said:
> 
> > > In this situation, it's good to have a data element which can
> > > represent **something in native format** (or anything,
> > > hopefully).
> > 
> > No, you can't. Or rather, I expect it is an issue of terminology :-)
> 
> He meant in the algorithm/protocol/curve native format.  In fact we
> already use the term "Native point format of the curve follows" in
> the ECC point compression flag bytes.
> 
> > On the other hand, if you mean an opaque blob private to the
> > algorithm,
> > that's perfectly fine (and what's already there, I think) *but* you
> > need to define it anyway, it doesn't matter if it's in the OpenPGP
> > spec
> 
> The algorithm/protocol/curve already defines this.

Thanks Werner. I kinda expected that Niibe meant something like that.
But it needs to be stated more clearly.


I think the text should be something like this:

> Algorithm-Specific Part for ECDSA Keys
> The public key is this series of values:
> 
> 
> a variable-length field containing a curve OID, formatted as follows:
> 
> 	a one-octet size of the following field; values 0 and 0xFF are
> reserved for future extensions,
> 
> 	the octets representing a curve OID, defined in {{ecc-curve-oid}};
> 
> a variable length field containing curve-specific octets,
> representing a public key.
> 
> 
> The secret key is this single multiprecision integer:
> 
> a variable length field containing curve-specific octets,
> representing the secret key, which is a scalar of the public EC point.

And then another section like:

#### Curve-specific octets

For Curve25519: a block of 32 bytes which encode a scalar in the way
defined on section 5 of rfc7748.
For Curve448: a block of 56 bytes which encode a scalar in the way
defined on section 5 of rfc7748.

For NIST P-256:
...



(I used the term Curve-specific octets rather than Strange Octet String
in the draft, trying to keep it more obvious, albeit it's probably
still under-specified)


Best regards