Re: [Json] JSON Concluded? Well, maybe not

Phillip Hallam-Baker <ietf@hallambaker.com> Mon, 01 January 2018 06:27 UTC

Return-Path: <hallam@gmail.com>
X-Original-To: json@ietfa.amsl.com
Delivered-To: json@ietfa.amsl.com
Received: from localhost (localhost [127.0.0.1]) by ietfa.amsl.com (Postfix) with ESMTP id E5737126D45 for <json@ietfa.amsl.com>; Sun, 31 Dec 2017 22:27:22 -0800 (PST)
X-Virus-Scanned: amavisd-new at amsl.com
X-Spam-Flag: NO
X-Spam-Score: -1.399
X-Spam-Level:
X-Spam-Status: No, score=-1.399 tagged_above=-999 required=5 tests=[BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, FREEMAIL_FORGED_FROMDOMAIN=0.25, FREEMAIL_FROM=0.001, HEADER_FROM_DIFFERENT_DOMAINS=0.25, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, SPF_PASS=-0.001] autolearn=no autolearn_force=no
Authentication-Results: ietfa.amsl.com (amavisd-new); dkim=pass (2048-bit key) header.d=gmail.com
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 yR9MZgGZvvSS for <json@ietfa.amsl.com>; Sun, 31 Dec 2017 22:27:21 -0800 (PST)
Received: from mail-ot0-x22c.google.com (mail-ot0-x22c.google.com [IPv6:2607:f8b0:4003:c0f::22c]) (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 457BF1205F0 for <json@ietf.org>; Sun, 31 Dec 2017 22:27:21 -0800 (PST)
Received: by mail-ot0-x22c.google.com with SMTP id p31so34898259ota.4 for <json@ietf.org>; Sun, 31 Dec 2017 22:27:21 -0800 (PST)
DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:sender:in-reply-to:references:from:date:message-id :subject:to:cc; bh=0hDtPjYzMs9pyF6502kMegumxiBRmiNpnLsy66ScyaI=; b=tBh6ZWnjCewV+jVGHKZ8lJsqnSQhwL3YM/LItBXypYiRCChYoXQu/aFWLd6qwhRkUA 8eqU5aqeS6vG4uWJNiZDLDQ7nykUqEB6P6AY56zupgOkvwfVzUyTQQYeYFhvr1QgC73l zRb8t2ErQn4LPduxJA5VlVBu+3l7MicKa/N2Z4nOKhy9v+XhXzwh/ha/2zVnVSrHv6G/ SWK9ahnu5Z2KpU6mYgucIzY4GeZOyyDDh+OA7zNGBAzFItfAiUefd58/GejgLA4YNXAs xl4GJXvfHuX9yIjFOlZJ2WbV1NLAxXNJENoS3L6g6bBy+Ujljl7hOGRMiN3iSFwoao8T 9lGA==
X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:sender:in-reply-to:references:from :date:message-id:subject:to:cc; bh=0hDtPjYzMs9pyF6502kMegumxiBRmiNpnLsy66ScyaI=; b=TWmJbz90lpID4MdjHpsLmoywj9Rgd+Wplb+TvPpulIAGfI6u5R5I8p0UKWRw0r5LiK KT8CAKP6ju4bvR94PuZRniuabiePI54fPGZuVpHTIvKfg3d+Yem5/YrbZ/sbA6Hk51Wa nNRIoNNQQfImvGRxYTQN6oGZF2xEtSowjahnu1pH1hkQLZmj60F7YnbW+6DoYF8VBdkS 33AQDX5Af/CTPb3YGD5kUXRVUeeOb2vuZn+39gYxM0s+kQQnXvfiw4gcu2OItaqEY8qv Z09kk+si1EJptggDjB+GyNyE5sTR9VclNA//v3PUaiAhcFwTIGGJj3tqEvUs3gv7XLfm j36Q==
X-Gm-Message-State: AKGB3mIcpkt5hh7FUm2pzNK2oMe/qZvMkYAkNWjdu5bwzpIVWXZ0VSsM dblpvetkZa/0INxIJDuNU2XPzGwFGtSvgBVdRXA=
X-Google-Smtp-Source: ACJfBouOMXrN9K4MRBZqNQTrFOg1SFBP3X6+xdcvGd8XLQV1eh9DYeNmQDbqeInXjWQf5qiyiYvY7kOQQIqu8n9qvu0=
X-Received: by 10.157.63.69 with SMTP id m63mr17590038otc.52.1514788040510; Sun, 31 Dec 2017 22:27:20 -0800 (PST)
MIME-Version: 1.0
Sender: hallam@gmail.com
Received: by 10.157.49.87 with HTTP; Sun, 31 Dec 2017 22:27:19 -0800 (PST)
In-Reply-To: <cb1ce20d-67f0-f4f4-8077-57c3d3f232b7@gmail.com>
References: <13860352-ef8e-1d4b-2eff-27e275c25e3a@gmail.com> <CALH+fvqBGu0i=LcciYgOLSwbQJXfqgcXTdd=rxvfHfqiRyBj7g@mail.gmail.com> <CAHBU6itC+XAKhc_m_ywG5O2bpky9DnmzfiNVqP3WrxLaE7uenA@mail.gmail.com> <92077f95-5dd6-3f5b-4765-d14067f698ac@dret.net> <CADEL5zshRaHtVNAtNggwHaPKP9xWeePcBZcQc1EM8SEfUu41Uw@mail.gmail.com> <CALH+fvqkBkQCiXfx1cxXaX092sbW6fgUmUizXP1f=ScMZ3bBqQ@mail.gmail.com> <cb1ce20d-67f0-f4f4-8077-57c3d3f232b7@gmail.com>
From: Phillip Hallam-Baker <ietf@hallambaker.com>
Date: Mon, 01 Jan 2018 01:27:19 -0500
X-Google-Sender-Auth: mW1iLy1LWJ-x9rQOHAiuDZzf2Fg
Message-ID: <CAMm+Lwiuod4Xf4=a8m25aNt626xCrO0Xet=96vn=R0eEwyjV1g@mail.gmail.com>
To: Anders Rundgren <anders.rundgren.net@gmail.com>
Cc: Richard Gibson <richard.gibson@gmail.com>, JSON WG <json@ietf.org>
Content-Type: multipart/alternative; boundary="001a114733041091c90561b11328"
Archived-At: <https://mailarchive.ietf.org/arch/msg/json/ehJ0CcZ4vRlJy9KX_GXNPuH2RRE>
Subject: Re: [Json] JSON Concluded? Well, maybe not
X-BeenThere: json@ietf.org
X-Mailman-Version: 2.1.22
Precedence: list
List-Id: "JavaScript Object Notation \(JSON\) WG mailing list" <json.ietf.org>
List-Unsubscribe: <https://www.ietf.org/mailman/options/json>, <mailto:json-request@ietf.org?subject=unsubscribe>
List-Archive: <https://mailarchive.ietf.org/arch/browse/json/>
List-Post: <mailto:json@ietf.org>
List-Help: <mailto:json-request@ietf.org?subject=help>
List-Subscribe: <https://www.ietf.org/mailman/listinfo/json>, <mailto:json-request@ietf.org?subject=subscribe>
X-List-Received-Date: Mon, 01 Jan 2018 06:27:23 -0000

The use case that I believe gives rise to the belief canonicalization is
necessary is the need to sign a data object in the same JSON document. I
have this need frequently:

{ {A = [... JSON Data...]} { Signature (A) } }

The way I solve this using JSON is to BASE-64 encode:

{ { A = base64(... JSON Data...)} { Signature (A) } }

Which is brutal but entirely effective and only expands the data by 33%

For an efficient encoding, I use JSON-B which is a strict superset of JSON
with additional code points that allow binary data to be spliced in.

JSON only uses bytes in the range 1-127 for tagging. Bytes in the range
128-255 can only occur inside strings. Which means all the other values can
be repurposed

In JSON-B, the binary sequence 01 02 03 can be encoded as either "AQID" or

88 03 01 02 03

The first byte says that this is a binary value with an 8 bit length and
the final block of the sequence (i.e. there is only one block in this
sequence).

The second byte is the length.

The rest is the data.


I would much rather extend JSON to support efficient encoding of any binary
value than develop a canonicalization hack that could only ever work for
JSON.

http://www.prismproof.org/Documents/draft-hallambaker-jsonbcd.html