Re: [jose] JWK Elliptic Curve key representations and new curves

Mike Scott <mike.scott@certivox.com> Thu, 14 August 2014 08:22 UTC

Return-Path: <mike.scott@certivox.com>
X-Original-To: jose@ietfa.amsl.com
Delivered-To: jose@ietfa.amsl.com
Received: from localhost (ietfa.amsl.com [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 9DAA71A0968 for <jose@ietfa.amsl.com>; Thu, 14 Aug 2014 01:22:32 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2.602
X-Spam-Level:
X-Spam-Status: No, score=-2.602 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, RCVD_IN_DNSWL_LOW=-0.7, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001] 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 ekabEWGos2Bm for <jose@ietfa.amsl.com>; Thu, 14 Aug 2014 01:22:25 -0700 (PDT)
Received: from emea01-db3-obe.outbound.protection.outlook.com (mail-db3lrp0081.outbound.protection.outlook.com [213.199.154.81]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 9486E1A0059 for <jose@ietf.org>; Thu, 14 Aug 2014 01:22:18 -0700 (PDT)
Received: from DB4PR03MB377.eurprd03.prod.outlook.com (10.242.231.12) by DB4PR03MB380.eurprd03.prod.outlook.com (10.242.231.18) with Microsoft SMTP Server (TLS) id 15.0.1005.10; Thu, 14 Aug 2014 08:22:16 +0000
Received: from DB4PR03MB377.eurprd03.prod.outlook.com ([10.242.231.12]) by DB4PR03MB377.eurprd03.prod.outlook.com ([10.242.231.12]) with mapi id 15.00.1005.008; Thu, 14 Aug 2014 08:22:16 +0000
From: Mike Scott <mike.scott@certivox.com>
To: Daniel Holth <dholth@gmail.com>, Mike Jones <Michael.Jones@microsoft.com>
Thread-Topic: [jose] JWK Elliptic Curve key representations and new curves
Thread-Index: Ac+3YKPoN/N5liajT+icFbBFv1/9ngABbE4AAAxFxU4=
Date: Thu, 14 Aug 2014 08:22:16 +0000
Message-ID: <1408004416408.82777@certivox.com>
References: <4E1F6AAD24975D4BA5B16804296739439AE1989B@TK5EX14MBXC293.redmond.corp.microsoft.com>, <CAG8k2+4rBnaZ4U4N49AgceAcNXeXcxjCzg+PgEy4woREAg=SmA@mail.gmail.com>
In-Reply-To: <CAG8k2+4rBnaZ4U4N49AgceAcNXeXcxjCzg+PgEy4woREAg=SmA@mail.gmail.com>
Accept-Language: en-IE, en-US
Content-Language: en-IE
X-MS-Has-Attach:
X-MS-TNEF-Correlator:
x-originating-ip: [136.206.195.136]
x-microsoft-antispam: BCL:0;PCL:0;RULEID:;UriScan:;
x-forefront-prvs: 03030B9493
x-forefront-antispam-report: SFV:NSPM; SFS:(10009004)(6009001)(51704005)(24454002)(377454003)(189002)(199003)(92566001)(4396001)(74502001)(19580405001)(81342001)(1511001)(77982001)(92726001)(2656002)(50986999)(15975445006)(79102001)(36756003)(76482001)(83072002)(86362001)(85852003)(107046002)(95666004)(85306004)(64706001)(20776003)(99396002)(66066001)(83322001)(54356999)(21056001)(105586002)(106356001)(46102001)(81542001)(19580395003)(87936001)(31966008)(74662001)(101416001)(76176999)(80022001); DIR:OUT; SFP:1101; SCL:1; SRVR:DB4PR03MB380; H:DB4PR03MB377.eurprd03.prod.outlook.com; FPR:; MLV:sfv; PTR:InfoNoRecords; MX:1; A:1; LANG:en;
Content-Type: text/plain; charset="Windows-1252"
Content-Transfer-Encoding: quoted-printable
MIME-Version: 1.0
X-OriginatorOrg: certivox.com
Archived-At: http://mailarchive.ietf.org/arch/msg/jose/cHzHjv_k1QlphA8cyGOhqOA2Z0o
Cc: Trevor Perrin <trevp@trevp.net>, "jose@ietf.org" <jose@ietf.org>
Subject: Re: [jose] JWK Elliptic Curve key representations and new curves
X-BeenThere: jose@ietf.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: Javascript Object Signing and Encryption <jose.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/jose>, <mailto:jose-request@ietf.org?subject=unsubscribe>
List-Archive: <http://www.ietf.org/mail-archive/web/jose/>
List-Post: <mailto:jose@ietf.org>
List-Help: <mailto:jose-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/jose>, <mailto:jose-request@ietf.org?subject=subscribe>
X-List-Received-Date: Thu, 14 Aug 2014 08:22:32 -0000

Be careful not to confuse Ed25519 with Curve25519. The former uses Edwards coordinates in which case (x,y) coordinates are appropriate. The latter uses Montgomery coordinates, which only require an x coordinate for the special case of an implementation of the Diffie-Hellman key exchange.

In fact all coordinate systems can use a "compressed" form of just x and at most 1 bit to indicate the sign of y (recall that x and y are related via the curve equation). However compression (or some forms of it) was patented, and hence avoided. However I believe that patent has now lapsed (?) As I recall IEEE1363 supports a compressed representation of points.
  
Also "decompression" has a cost associated with it, although this doesn't arise for Curve25519 where it is never required to recover the y coordinate


Mike Scott

________________________________________
From: jose <jose-bounces@ietf.org> on behalf of Daniel Holth <dholth@gmail.com>
Sent: 14 August 2014 03:20
To: Mike Jones
Cc: Trevor Perrin; jose@ietf.org
Subject: Re: [jose] JWK Elliptic Curve key representations and new curves

On Wed, Aug 13, 2014 at 9:39 PM, Mike Jones <Michael.Jones@microsoft.com> wrote:
> It has come up in recent discussions in the CRFG, the W3C WebCrypto working
> group, and the TLS working group that not all elliptic curves or curve
> protocols use two coordinates (x and y) in their public key representations.
> For instance, a Curve25519 public key is a single 32-byte value.  Especially
> in light of the request by TLS to the CRFG to recommend new curves, and that
> some of the curves in consideration use only a single value in their public
> key representation, I believe that JOSE should consider how to represent
> such keys as JWKs.
>
>
>
> I see there being two logical ways to address this:
>
>
>
> CHOICE 1 – MAKE THE “EC” KEY TYPE MORE FLEXIBLE:  One obvious possibility is
> to make it a property of the “crv” parameter for JWKs with “kty”: “EC” what
> fields are required.  So for instance, when “crv” is “P-256”, “P-384”, or
> “P-521”, both “x” and “y” members would be used, but other curves might use
> a different set of members, such as just “x” for public keys.
>
>
>
> CHOICE 2 – USE A DIFFERENT KEY TYPE:  Another possibility is to leave the
> “kty”: “EC” definition as it is but to define a related “kty”: “EC1” value
> to be used by elliptic curves for which only one value “x” is used in the
> public key representation and an additional value “d” is used in the private
> key representation.
>
>
>
> Within choice 2, there are actually two sub-choices available to us:
>
>
>
> CHOICE 2A – DEFINE A NEW KEY TYPE VALUE IN JWA NOW:  If we think that there
> are only two kinds of elliptic curve key representations that we will ever
> care about, we could define the second one in JWA now.  However, this would
> almost certainly start a debate within JOSE about whether we should add any
> additional curve definitions using this new key type.  If we do, it should
> almost certainly be because we have followed the CFRG’s and TLS’s lead in
> the new curve choices, although doing so would almost certainly further
> delay our completion.
>
> CHOICE 2B – DEFINE THE NEW KEY TYPE IN A NEW SPEC:   This could be done by
> writing an individual draft that registers “kty”: “EC1” and later possibly
> adopting it as a working group item.  This would allow our current specs to
> proceed as-is, while giving us time to sync with CFRG and TLS as their curve
> choices move forwards.
>
>
>
> One additional pesky detail worth noting is that the normal Curve25519 key
> representation uses little-endian 32-bit numbers whereas SEC1 (which we use
> for “x”, “y”, and “d”) uses big-endian numbers.  So for any of these choices
> above, we’d also have to decide whether to allow different curves to specify
> different endianness, require all to use big-endian representations, or to
> say that for some curves, the value is an octet array of a given size and be
> silent on endianness.
>
>
>
> While I’m reluctant to even bring this up at this point in the development
> of our specs, I also don’t want those designing potential applications of
> JWKs to believe that their choices of curves are limited by decisions that
> JOSE has made.  It’s clear that JWK can be extended to accommodate curves
> using only a single value in their public key representations.
>
>
>
> How do you think we should do that?
>
>
>
>                                                                 -- Mike
>
>
>
> P.S.  Thanks to Trevor Perrin for private discussions that informed some of
> the contents of this note.

I didn't find the existing spec a burden. My JWK-derived system uses {
"kty" : "Ed25519", vk : "the base64url-encoded verifying key" } and
uses "Ed25519" as alg as well. (In the less necessary JWK private key
representation "sk" : "..." is used for the secret part).

Is there some economy that makes it desirable to have a Ed25519 JWK
look similar to any other elliptic curve key that only uses one
(opaque?) parameter? The constant-time implementation (no secret
branching) is monolithic, specialized to that curve and is not built
out of reconfigurable pieces.

Curve1174 "Elligator" is another elliptic curve system by DJB etc.
that looks like it shares some of the attributes of Ed25519.

Daniel Holth

_______________________________________________
jose mailing list
jose@ietf.org
https://www.ietf.org/mailman/listinfo/jose