Re: [jose] New Version Notification for draft-barnes-jose-jsms-00.txt

"Richard L. Barnes" <rbarnes@bbn.com> Tue, 26 June 2012 22:24 UTC

Return-Path: <rbarnes@bbn.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 C855D11E80DE for <jose@ietfa.amsl.com>; Tue, 26 Jun 2012 15:24:01 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -106.227
X-Spam-Level:
X-Spam-Status: No, score=-106.227 tagged_above=-999 required=5 tests=[AWL=-0.228, BAYES_00=-2.599, J_CHICKENPOX_47=0.6, RCVD_IN_DNSWL_MED=-4, USER_IN_WHITELIST=-100]
Received: from mail.ietf.org ([12.22.58.30]) by localhost (ietfa.amsl.com [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id a2JVtOcctonO for <jose@ietfa.amsl.com>; Tue, 26 Jun 2012 15:24:00 -0700 (PDT)
Received: from smtp.bbn.com (smtp.bbn.com [128.33.1.81]) by ietfa.amsl.com (Postfix) with ESMTP id A573B11E80D7 for <jose@ietf.org>; Tue, 26 Jun 2012 15:24:00 -0700 (PDT)
Received: from ros-dhcp192-1-51-6.bbn.com ([192.1.51.6]:61493) by smtp.bbn.com with esmtps (TLSv1:AES128-SHA:128) (Exim 4.77 (FreeBSD)) (envelope-from <rbarnes@bbn.com>) id 1SjeAI-0007Us-Fh; Tue, 26 Jun 2012 18:23:18 -0400
Mime-Version: 1.0 (Apple Message framework v1278)
Content-Type: text/plain; charset="us-ascii"
From: "Richard L. Barnes" <rbarnes@bbn.com>
In-Reply-To: <57BD4255-754D-4B6D-A194-587243FF17F3@bbn.com>
Date: Tue, 26 Jun 2012 18:23:58 -0400
Content-Transfer-Encoding: quoted-printable
Message-Id: <B084145D-770C-452D-BCBC-DA0F0BA539EA@bbn.com>
References: <4E1F6AAD24975D4BA5B168042967394366569B1D@TK5EX14MBXC283.redmond.corp.microsoft.com> <57BD4255-754D-4B6D-A194-587243FF17F3@bbn.com>
To: Mike Jones <Michael.Jones@microsoft.com>
X-Mailer: Apple Mail (2.1278)
Cc: John Bradley <ve7jtb@ve7jtb.com>, Brian Campbell <bcampbell@pingidentity.com>, "jose@ietf.org" <jose@ietf.org>
Subject: Re: [jose] New Version Notification for draft-barnes-jose-jsms-00.txt
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: Tue, 26 Jun 2012 22:24:01 -0000

> Sure, multiple signature is easier than multiple recipients.  But I wouldn't call it simple.  I have to base64url-decode each header to figure out which one to use (but keep around the encoded version, so I can verify the signature), keep track of the corresponding signature value, and reconstruct the signed body -- all before I can do the actual signature verification.
> 
> OTOH, without integrity-protection, you can just have the signature beside all the other parameters, in plain JSON, so that you can just grab stuff and go.

Addendum: This assumes that you're doing the base64-encoding thing to allow integrity protection.  If we do canonicalization, this issue goes away.  But then we have to do canonicalization.


> From <https://raw.github.com/bifurcation/jsms/master/jose.js>:
> 
>    verify: function(object) {
>        var jsms = JSON.parse(object);
>        if (!_JOSE_Support.isSignedData(jsms)) {
>            throw "Invalid SignedData object";
>        }
> 
>        // Figure out which signatures are valid
>        var validPublicKeys = [];
>        var sigs = jsms.signatures;
>        for (var i=0; i<sigs.length; ++i) {
>            var result = _JOSE_Crypto.verify_pkcs1_sha256(
>                sigs[i].key.n, sigs[i].key.e, jsms.content, sigs[i].signature)
>            if (result = "True") {
>                validPublicKeys.push(sigs[i].key);
>            }
>        }
> 
>        return validPublicKeys;
>    }
> 
> 
> 
> 
> On Jun 26, 2012, at 6:03 PM, Mike Jones wrote:
> 
>> http://tools.ietf.org/html/draft-jones-json-web-signature-json-serialization-01 is an existence proof that it's not hard to sign the parameters and have multiple signatures.
>> 
>> 				-- Mike
>> 
>> -----Original Message-----
>> From: jose-bounces@ietf.org [mailto:jose-bounces@ietf.org] On Behalf Of Richard L. Barnes
>> Sent: Tuesday, June 26, 2012 10:46 AM
>> To: Brian Campbell
>> Cc: John Bradley; jose@ietf.org
>> Subject: Re: [jose] New Version Notification for draft-barnes-jose-jsms-00.txt
>> 
>> I agree with that goal!  I disagree that JWS is a good solution.  
>> 
>> It is true that JWS provides a relatively simple mechanism for a single signature, but:
>> 1. It could be simpler (see below)
>> 2. JWS header protection is useless for the single-signature case, and makes the multiple-signature/recipient case harder
>> 
>> --Richard
>> 
>> 
>> 
>> On Jun 26, 2012, at 12:16 PM, Brian Campbell wrote:
>> 
>>> I wasn't suggesting that integrity-protecting the header itself makes 
>>> things simpler. Rather that a desirable goal is for support of a 
>>> relatively simple model utilizing a single signature over the whole 
>>> message. And that we already have that in JWS.
>>> 
>>> On Mon, Jun 25, 2012 at 3:55 PM, Richard L. Barnes <rbarnes@bbn.com> wrote:
>>>> 
>>>> On Jun 25, 2012, at 5:53 PM, Richard L. Barnes wrote:
>>>> 
>>>>>>> I think part of this is that as one of the openID Connect authors I look at this as a necessary security token format, for OAuth and Connect.
>>>>>>> For that simple processing with one signature is a high priority for adoption.
>>>>>> 
>>>>>> +1.
>>>>>> 
>>>>>> A simple JSON friendly model supporting a single signature over the 
>>>>>> entire message (including headers) is an important case for 
>>>>>> adoption (and security). JWS provides that now and there are 
>>>>>> already numerous interoperable JWS implementations available or in the works.
>>>>> 
>>>>> I'm not sure how people think that integrity-protecting the header makes things *simpler*, especially since it adds a whole new decoding step and makes the parsing more complicated.
>>>>> 
>>>>> Pseudocode without integrity protection (assuming JSMS format, but JWS could be made to look similar):
>>>>> function verify(json) {
>>>>>  jose = JSON.parse(json);
>>>>>  // Check algorithm values
>>>>>  return Crypto.SignatureAlgorithm.verify(jose.content, 
>>>>> jose.keys[0].signature, jose.keys[0].key); }
>>>>> 
>>>>> Pseudocode with integrity protection (assuming JWS format):
>>>>> function verify(jws) {
>>>>>  (txtHeader, content, signature) = jws.split("\.");
>>>>>  protectedBody = header + "." + content
>>>>>  jsonHeader = base64url.decode(txtHeader);
>>>>>  header = JSON.parse(jsonHeader);
>>>>>  return Crypto.SignatureAlgorithm.verify(content, signature, 
>>>>> header.jwk); }
>>>>> 
>>>> 
>>>> Err, sorry, that should read:
>>>>  protectedBody = txtHeader + "." + content; and
>>>>  return Crypto.SignatureAlgorithm.verify(protectedBody, signature, 
>>>> header.jwk);
>>>> 
>>>> See how hard it is to get right?  :)
>>>> 
>>>> --Richard
>>> _______________________________________________
>>> 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
>> 
>> 
>> _______________________________________________
>> 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