Subject: Re: [jose] "typ":"JWS"

From: Mike Jones <[email-masked]>
Date: Fri, 6 Jul 2012 18:19:50 +0000

Thanks for the thought on this, James.

In the -03 drafts there is now a clear distinction between "typ" (type) - information about this object and the new "cty" (content type) - information about the secured object.  Besides being semantically cleaner, this also simplified nested JWTs.

I then was able to make changes in the spirit of the ones you suggested below, although using slightly different wording in some cases.

                                                                -- Mike

From: Manger, James H [mailto:[email-masked]]<mailto:[mailto:[email-masked]]>
Sent: Tuesday, May 15, 2012 5:40 PM
To: Mike Jones; [email-masked]<mailto:[email-masked]>
Subject: RE: "typ":"JWS"

>> draft-ietf-jose-json-web-signature-02 §7.2 registers the "JWS" type value (for the "typ" header field)
>> ...
>> Perhaps "typ":"JWS" is more useful in a JWE header when encrypting signed content (sign-then-encrypt). If this is the intention, then mentioning the "JWS" type value when defining the "typ" header for a JWS is misleading. It would be better to mention it where the JWE spec defines "typ".
>> ...

> Your second paragraph correctly describes the intended usage.  For instance, see http://tools.ietf.org/html/draft-jones-json-web-token-10#section-5.1 for this usage in action.  The value is registered per the working group decision relating "typ" values to MIME types.

Good. So let's say that. Suggested text changes:

* draft-ietf-jose-json-web-signature-02, section 4.1.8 "typ" (Type) Header Parameter: delete the 2nd sentence because signing a signature is not what we are talking about (and JWS-JS recommends a different approach for multiple signatures anyway).

* section 7.1 Registration of application/jws MIME Media Type: add a phrase explicitly stating the syntax (since the spec mentions two: compact, and JWS JS) so the section says:
  This specification registers the "application/jws" MIME Media Type [RFC 2045]
  to identify content that uses the JWS compact serialization.

* section 7.2 Registration of "JWS" Type Value: mention the intended use of encrypting signed content by adding this sentence.
  The "typ" parameter can be set to "JWS" in a JSON Web Encryption [JWE] header when encrypting signed content.

* draft-ietf-jose-json-web-encryption-02, section 4.1.13 "typ" (Type) Header Parameter, section 11.1 Registration of application/jwe MIME Media Type, section 11.2 Registration of "JWE" type Value: make equivalent changes.

--
James Manger

---

From: "Richard L. Barnes" <[email-masked]>
Date: Fri, 6 Jul 2012 14:22:31 -0400

Not sure what the appropriate list is for this, so I'm just going to ask it here:

What is a "nested JWT"?  I'm guessing it's a JWT claim set wrapped in JWS multiple times, as in the example we were discussing earlier?

Why would you want to do that instead of having parallel signatures?

On Jul 6, 2012, at 2:19 PM, Mike Jones wrote:

> In the -03 drafts there is now a clear distinction between “typ” (type) - information about this object and the new “cty” (content type) – information about the secured object.  Besides being semantically cleaner, this also simplified nested JWTs.
>  
> From: Manger, James H [mailto:[email-masked]] 
> To: Mike Jones; [email-masked]
> Subject: RE: "typ":"JWS"
>  
> >> draft-ietf-jose-json-web-signature-02 §7.2 registers the “JWS” type value (for the “typ” header field)
> >> …
> >> Perhaps “typ”:”JWS” is more useful in a JWE header when encrypting signed content (sign-then-encrypt). If this is the intention, then mentioning the “JWS” type value when defining the “typ” header for a JWS is misleading. It would be better to mention it where the JWE spec defines “typ”.
> >> …
>  
> > Your second paragraph correctly describes the intended usage.  For instance, see http://tools.ietf.org/html/draft-jones-json-web-token-10#section-5.1 for this usage in action.  The value is registered per the working group decision relating “typ” values to MIME types.
>  
> Good. So let’s say that. Suggested text changes:
>  
> * draft-ietf-jose-json-web-signature-02, section 4.1.8 “typ” (Type) Header Parameter: delete the 2nd sentence because signing a signature is not what we are talking about (and JWS-JS recommends a different approach for multiple signatures anyway).
>  
>   The “typ” parameter can be set to “JWS” in a JSON Web Encryption [JWE] header when encrypting signed content.
>  
> * draft-ietf-jose-json-web-encryption-02, section 4.1.13 “typ” (Type) Header Parameter, section 11.1 Registration of application/jwe MIME Media Type, section 11.2 Registration of “JWE” type Value: make equivalent changes.
>  
> --
> James Manger
>  
> _______________________________________________
> jose mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/jose

---

From: Mike Jones <[email-masked]>
Date: Fri, 6 Jul 2012 18:27:02 +0000

I'll reply to this on the OAuth list, since JWT is an OAuth spec.

-----Original Message-----
From: Richard L. Barnes [mailto:[email-masked]] 
Sent: Friday, July 06, 2012 11:23 AM
To: Mike Jones
Cc: Manger, James H; [email-masked]
Subject: Nested JWT (was: Re: [jose] "typ":"JWS")

On Jul 6, 2012, at 2:19 PM, Mike Jones wrote:

> Mike
> >> draft-ietf-jose-json-web-signature-02 §7.2 registers the "JWS" type 
> >> value (for the "typ" header field) . Perhaps "typ":"JWS" is more 
> >> useful in a JWE header when encrypting signed content (sign-then-encrypt). If this is the intention, then mentioning the "JWS" type value when defining the "typ" header for a JWS is misleading. It would be better to mention it where the JWE spec defines "typ".
> >> .
>

---

From: "Manger, James H" <[email-masked]>
Date: Sun, 8 Jul 2012 00:29:45 +1000

“typ” is still confusing. The definition is:

  The "typ" (type) header parameter is used to declare
 the type of this object.

First a minor issue. Does “this object” refer to the JSON object that holds the “typ” field, or the bigger dot-separated-base64-blobs it is part of, or an even higher-level application-specific thing?

The JWE and JWS specs say, respectively, “typ”:”JWE” and “typ”:”JWS” MAY be used.
This almost suggests you can use the “typ” field to distinguish whether you have a JWE or JWS or some other future variety of JOSE message (plain, checksummed…) — instead of needing to recognize the “alg” value. That doesn’t work however. Firstly, “typ” is OPTIONAL. Secondly, even when “typ” is present in a JWE message, its value MAY be “JWE” — not MUST. The “typ” value MAY also be a media type (perhaps “typ”:”application/jwe”?), or a value that SHOULD be registered, or any arbitrary URI.

The JWT spec [draft-ietf-oauth-json-web-token-01] then RECOMMENDS that “typ”:”JWT” be used *in a JWE or JWS header*.

So in a JWE message, when do you use “typ”:”JWE”, when do you use “typ”:”JWT”, and when do you omit it?

The following make sense to me, but are not what is specified:
1* The header for a signed set of claims:
      { “typ”:”JWS”, “cty”:”JWT”, “alg”:”HS256”, …}
2* The header for an encrypted set of claims:
      { “typ”:”JWE”, “cty”:”JWT”, “alg”:”RSA-OAEP”, …}
3* The header for a signed-then-encrypted set of claims:
      { “typ”:”JWE”, “cty”:”JWS”, “alg”:”RSA-OAEP”, …}
3b* Then after decrypting the ciphertext you see the header:
      { “typ”:”JWS”, “cty”:”JWT”, “alg”:”HS256”, …}

There are 3 pieces of information we need in a JOSE message in this area:
1* Which variety of JOSE message is this: signed, encrypted, unprotected, or some future variety?
2* Is there another JOSE layer after this one (eg signed-then-encrypted as 2 JOSE layers)?
3* Optionally, metadata about the final content (eg media type).

“cty” fits into #3. “cty” could almost (but poorly) fit #2 if it was REQUIRED when there is another JOSE layer and the JOSE content-types were easily distinguished from any other content type. A separate flag would be a better fit for #2 (eg “emb”:true). Some values of “typ” fit #1, but not in general.

--
James Manger

From: Mike Jones [mailto:[email-masked]]
Sent: Saturday, 7 July 2012 4:20 AM
To: Manger, James H; [email-masked]
Subject: RE: "typ":"JWS"

                                                                -- Mike