Re: [jose] Reducing the size of JWS payloads

Dick Hardt <dick.hardt@gmail.com> Wed, 19 December 2012 16:39 UTC

Return-Path: <dick.hardt@gmail.com>
X-Original-To: jose@ietfa.amsl.com
Delivered-To: jose@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id 1111B21F84DB for <jose@ietfa.amsl.com>; Wed, 19 Dec 2012 08:39:29 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -3.598
X-Spam-Level:
X-Spam-Status: No, score=-3.598 tagged_above=-999 required=5 tests=[AWL=-0.000, BAYES_00=-2.599, BODY_ENHANCEMENT2=0.001, RCVD_IN_DNSWL_LOW=-1]
Received: from mail.ietf.org ([64.170.98.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 0eQRmMf68Elh for <jose@ietfa.amsl.com>; Wed, 19 Dec 2012 08:39:28 -0800 (PST)
Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by ietfa.amsl.com (Postfix) with ESMTP id 4D9EE21F84D8 for <jose@ietf.org>; Wed, 19 Dec 2012 08:39:28 -0800 (PST)
Received: by mail-pa0-f42.google.com with SMTP id rl6so1440945pac.29 for <jose@ietf.org>; Wed, 19 Dec 2012 08:39:28 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=x-received:content-type:mime-version:subject:from:in-reply-to:date :cc:content-transfer-encoding:message-id:references:to:x-mailer; bh=y6NQTW298LuvxIaFbWs4teDozq4JFJFjqXm3zbh20u8=; b=bO5gdOfn1Hg0290L27Q2WDIKgSr5dd7QGpaYJ+HajjcIKqXzYrKn/ThP8W86LN1OtV h01X5+OHhcGlaZtcqme+4vm3KflB4qT9FjANG7lyE3Oo5OJitSaAq4QkbZy9kdR9jcVk h9lkndzaoKtD4hhG0zBv6VKyNV6fmZkdTcu1yqnYqKxTJgpWLtL3BZnW2uvK/J5VWnaZ gIBABRk/2wyCot+b3fun2/Z2L6ccdTDSvZJnIl0pTsPI+BL5YfeVNXFscf8NBiLJKLHU 3U5YhGp0tsYCjJQGEITk2eyaAvv/l9qBpOej6fRiwGYXkppnFDyK0TXrok1aRUtOWnmi lclg==
X-Received: by 10.66.82.67 with SMTP id g3mr18677627pay.58.1355935167871; Wed, 19 Dec 2012 08:39:27 -0800 (PST)
Received: from [10.0.0.4] (c-24-5-69-173.hsd1.ca.comcast.net. [24.5.69.173]) by mx.google.com with ESMTPS id gj1sm3372948pbc.11.2012.12.19.08.39.25 (version=TLSv1/SSLv3 cipher=OTHER); Wed, 19 Dec 2012 08:39:26 -0800 (PST)
Content-Type: text/plain; charset="us-ascii"
Mime-Version: 1.0 (Mac OS X Mail 6.2 \(1499\))
From: Dick Hardt <dick.hardt@gmail.com>
In-Reply-To: <79f178fcdba34e6ea83635761d795178@BY2PR03MB041.namprd03.prod.outlook.com>
Date: Wed, 19 Dec 2012 08:39:24 -0800
Content-Transfer-Encoding: quoted-printable
Message-Id: <9F135913-1D88-4842-B51E-C584D4510BF9@gmail.com>
References: <4E1F6AAD24975D4BA5B16804296739436696B341@TK5EX14MBXC283.redmond.corp.microsoft.com> <A96543D2-9380-4191-89AD-6A896B461938@gmail.com> <79f178fcdba34e6ea83635761d795178@BY2PR03MB041.namprd03.prod.outlook.com>
To: Anthony Nadalin <tonynad@microsoft.com>
X-Mailer: Apple Mail (2.1499)
Cc: Mike Jones <Michael.Jones@microsoft.com>, "jose@ietf.org" <jose@ietf.org>, Dick Hardt <dick.hardt@gmail.com>
Subject: Re: [jose] Reducing the size of JWS payloads
X-BeenThere: jose@ietf.org
X-Mailman-Version: 2.1.12
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: Wed, 19 Dec 2012 16:39:29 -0000

What "flexability" does it not allow?

Seems more flexible to me. 

On Dec 18, 2012, at 8:42 PM, Anthony Nadalin <tonynad@microsoft.com> wrote:

> This forces a specific way and does not allow the flexability
> 
> -----Original Message-----
> From: jose-bounces@ietf.org [mailto:jose-bounces@ietf.org] On Behalf Of Dick Hardt
> Sent: Tuesday, December 18, 2012 6:45 PM
> To: Mike Jones
> Cc: jose@ietf.org; Dick Hardt
> Subject: Re: [jose] Reducing the size of JWS payloads
> 
> Hi Mike
> 
> Thanks for bringing this up again. 
> 
> An alternative approach I proposed was to have both the encryption and signing information in one header, and to use the signing signature to ensure integrity instead of having a separate encryption integrity check. This would reduce the size of the token by the size of the integrity value +1 bytes, as well as reduce the processing.
> 
> Given that header properties are overloaded now (they have different meanings depending on being a JWE or JWS, we could put the encryption header values into a sub object in the header. Perhaps call that 'enc'.
> 
> -- Dick
> 
> The process below has 
> On Dec 18, 2012, at 6:26 PM, Mike Jones <Michael.Jones@microsoft.com> wrote:
> 
>> I've noticed that more than one person has expressed a desire to reduce the size of JWS payloads before signing.  This especially comes up when nested encryption and signing is being performed.  This note contains a quantitative evaluation of some possible methods of reducing JWS payload size and asks for working group input based upon the data.
>> 
>> Dick proposed one method below - have a header parameter to say that the payload is already URL-safe and that base64url encoding is not to be performed.  Another way that people have proposed is to allow the use of the "zip" parameter to compress the JWS payload before base64url encoding.  To get some initial data on how the solutions compare, I tried both methods using the sample JWE value in http://tools.ietf.org/html/draft-ietf-jose-json-web-encryption-07#appendix-A.2 as the JWS payload.
>> 
>> CURRENT SITUATION:  The JWE is 526 characters in length.  Currently, when used as a JWS payload, base64url encoding it would increase its size to 702 characters - an increase of 33% or 176 characters.
>> 
>> AVOIDING DOUBLE BASE64URL ENCODING:  If we used a header parameter "b64":false to indicate that no additional base64url encoding is to be performed, the payload would be 176 characters smaller than the current situation.  The encoded header size would increase by 16 characters - the number of characters needed to base64url encode this header parameter value and a comma, for a net decrease in size of 160 characters.  (Yes, parsing the three pieces would be slightly more difficult.)
>> 
>> APPLYING DEFLATE TO THE PAYLOAD:  Believe it or not, using DEFLATE on this input results in a LARGER output - 536 bytes or a net increase of 10 bytes.  If you think about it, this isn't too surprising, as the encrypted data should contain no usable predictability/redundancy.  Base64url encoding these 536 bytes results in a 715 character payload - an increase of 189 characters or 36%.  Plus, adding "zip":"DEF" to the header adds 16 characters, for a total increase of 29 characters over the current situation.  Clearly a suboptimal choice!
>> 
>> CONCLUSION:  Clearly, if we're going to enable reduction of the size of JWS payloads, avoiding the double base64url encoding is preferable to zip, which actually makes things worse.
>> 
>> QUESTION TO WORKING GROUP:  I'm curious whether people would like to see us enable avoiding double base64encoding of JWS payloads when they are already URL-safe.  The space savings are significant; they come at the cost of the JWS parsing becoming [part before first period . part between first and last period . part after last period] rather than the current [part before first period . part between first and second period . part after second period (with no other periods allowed)].  Opinions?
>> 
>> 				-- Mike
>> 
>> -----Original Message-----
>> From: jose-bounces@ietf.org [mailto:jose-bounces@ietf.org] On Behalf Of Dick Hardt
>> Sent: Monday, October 29, 2012 8:57 AM
>> To: jose@ietf.org
>> Subject: [jose] signing an existing JWT
>> 
>> 
>> Let's say we have created a JWE as such:
>> 	
>> 	headerOne.encryptedKeyOne.initializationVectorOne.ciphertextOne.integritityVectorOne
>> 
>> This is now the payload to a JWS. Rather than increasing the token size by 4/3 by URL safe base 64 encoding the payload (since it is already URL safe), it would be useful to have a JWS header parameter that indicates the payload was not re-encoded and does not need to be URL safe base 64 decoded.
>> 
>> As there are more periods than expected in a JWS, decoding would ignore all periods except the first and last one for separating out the header, payload and signature.
>> 
>> The indicating parameter would seem to be either "tip" or "cty". I'm still confused about the difference between the two parameters, so not sure which one is appropriate.
>> 
>> -- Dick
>> 
>> 
>> _______________________________________________
>> jose mailing list
>> jose@ietf.org
>> https://www.ietf.org/mailman/listinfo/jose
>> 
> 
> _______________________________________________
> jose mailing list
> jose@ietf.org
> https://www.ietf.org/mailman/listinfo/jose
> 
> 
>