Subject: [jose] JWK: comments on jku, kid, use, mod..

From: "Manger, James H" <[email-masked]>
Date: Mon, 21 May 2012 12:11:52 +1000

A "jku" value is a URL pointing to a 1 or more JSON Web Keys. A "kid" value (key id) is really needed to pick the right key from the set. Consequently the spec should say [in JWS section 4.1.2 "jku" (JWK Set URL) Header Parameter]:

    Producers MUST include a "kid" parameter when including a "jku" parameter.

"jku" makes sense for a JWS -- the receiver uses the "jku" URL to get the public key to verify the JWS signature. I'm not sure it makes sense in a JWE, though. The receiver needs a private key to decrypt, not the public key that "jku" points to. At best, "jku" in a JWE acts as an key id -- but we have a separate "kid" field. I think we should drop the "jku" parameter from the JWE spec.

The "use" (key use) parameter [JWK 4.2] should be a JSON array of strings, not a single string. It is nice crypto hygiene to have only 1 use for a key. However, multiple uses are common in practise and are not so atrocious that we should forbid it at a syntax level. Particularly given that "other values [than "sig" and "enc"] MAY be used".

I would add the word "unsigned" when defining the "mod" and "exp" fields for an RSA key[JWA sections 5.3.1 and 5.3.2] to explicitly avoid confusion given that other specs use signed representations (eg 2's complement) for these keys:

   It is represented as the base64url encoding of the value's
   *unsigned* big endian representation.

I am not sure if adding "unsigned" would clarify the definitions of "x" and "y" for elliptic curve keys since they are not always integers (depends on the type of curve).

--
James Manger