[jose] At a glance: JWS vs "in-object" ES6/JSON signatures

Anders Rundgren <anders.rundgren.net@gmail.com> Thu, 29 October 2015 06:39 UTC

Return-Path: <anders.rundgren.net@gmail.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 1BE681A882F for <jose@ietfa.amsl.com>; Wed, 28 Oct 2015 23:39:49 -0700 (PDT)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -2
X-Spam-Level:
X-Spam-Status: No, score=-2 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, FREEMAIL_FROM=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 iU4wYpq9DfhD for <jose@ietfa.amsl.com>; Wed, 28 Oct 2015 23:39:47 -0700 (PDT)
Received: from mail-wi0-x230.google.com (mail-wi0-x230.google.com [IPv6:2a00:1450:400c:c05::230]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ietfa.amsl.com (Postfix) with ESMTPS id 4F3A41A8829 for <jose@ietf.org>; Wed, 28 Oct 2015 23:39:47 -0700 (PDT)
Received: by wicfv8 with SMTP id fv8so33786424wic.0 for <jose@ietf.org>; Wed, 28 Oct 2015 23:39:46 -0700 (PDT)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:subject:to:message-id:date:user-agent:mime-version :content-type:content-transfer-encoding; bh=kRoHDuusqqGf5XTwMHPgaPPwUKrmBhO7tHbS+9uTSf8=; b=XsVs73LJComQUlfSK0Ho5D4NDM7PCV6Qn1RMAiDy9SHfHllf7VpOOPGYmEf/EwnOYx NL4vshTFExsr2kOiqHwQP34gA15StYEq8Bp4P47USBzbuyXH7cUMghTBxYKYb5IswHrC pJaT3TX9OlDehnDNrE1/TCxVz/3byYtGa8GBLE2qo+hhnKeOcbfPzc4wabpnRHZloJT4 5PkC1v4EZDwJHS1ds1MgcPZADt8u3HaqbXsbV+VIP6+/jqCpoooIXOyVDj486RsYC0BK HCz84vQGFLvGddwfgJzoJUstG267NdPeJAnCBbofWvdJMIBFVn13hYYS2BPPbp3o+1QK T0gA==
X-Received: by 10.194.203.101 with SMTP id kp5mr119079wjc.64.1446100785911; Wed, 28 Oct 2015 23:39:45 -0700 (PDT)
Received: from [192.168.1.79] (148.198.130.77.rev.sfr.net. [77.130.198.148]) by smtp.googlemail.com with ESMTPSA id gl4sm61105wjd.49.2015.10.28.23.39.44 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 28 Oct 2015 23:39:45 -0700 (PDT)
From: Anders Rundgren <anders.rundgren.net@gmail.com>
To: "jose@ietf.org" <jose@ietf.org>
Message-ID: <5631BF2A.70109@gmail.com>
Date: Thu, 29 Oct 2015 07:39:38 +0100
User-Agent: Mozilla/5.0 (Windows NT 6.3; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.3.0
MIME-Version: 1.0
Content-Type: text/plain; charset="utf-8"; format="flowed"
Content-Transfer-Encoding: 7bit
Archived-At: <http://mailarchive.ietf.org/arch/msg/jose/NRJLQE9ME0wuDLC0Rox_Y5g9c88>
Subject: [jose] At a glance: JWS vs "in-object" ES6/JSON signatures
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: <https://mailarchive.ietf.org/arch/browse/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, 29 Oct 2015 06:39:49 -0000

ES6-compliant in-object JS/JSON signature:

   var inObjectSignedData =
     {
         // Object data expressed as JS properties
         "device": "Pump2",
         "value": 1e-18,

         // Object signature
         "signature": {
             ...Protected headers + Signature value expressed as JS properties...
         }
     };

JavaScript's JSON.parse() and JSON.stringify() suffice for "canonicalization" purposes.


Converting the above to JWS JSON Serialization you would get:

var signedData =
   {
       // Object data in a coded format
       "payload":"<payload contents>",

       // Protected headers wrapped in Base64URL
       "protected":"<integrity-protected header contents>",

       // Signature in a unique format
       "signature":"<signature contents>"
   }

ES6 was released in June 2015 so this opportunity is actually quite new.

Cheers,
Anders

http://webpki.org/ietf/draft-rundgren-predictable-serialization-for-json-tools-00.html#rfc.section.3.3