Subject: [jose] Binary encoding for JSON

From: Phillip Hallam-Baker <[email-masked]>
Date: Tue, 11 Jun 2013 07:47:22 -0400

http://tools.ietf.org/html/draft-hallambaker-jsonbcd-00

The big problem I have found with using JSON for crypto is the lack of a
binary encoding for data. This means that binary blobs have to be encoded
as Base64 which is not too bad in itself except that when using nested
structures the base64 overhead expands the data by 33% each time it is
wrapped.

JSON-B is basically just a scheme that adds in a run-length encoding for
strings and binary data to JSON encoding. It is a superset of JSON and it
is very easy to adapt a JSON parser or encoder to add in support for JSON-B.

Unlike other binary encodings for JSON (BJSON etc), there is no need to
distinguish the binary form from the regular. A JSON-B decoder will accept
either form. This simplifies protocol negotiation as the only concern is
ensuring that the sender emits a form that the receiver can understand.

JSON-B also provides binary encodings for integers (including bignums up to
(2^23)  bits long) and doubles. The last being important in scientific
applications as converting to and from decimal form results in precision
loss.

There is also a JSON-C (Compact) and JSON-D (Data) defined.

The practical benefit of using this with JOSE is that it can be used to
frame the crypto data in the same way that ASN.1 is used in CMS but with
the same simplicity as using traditional JSON.

-- 
Website: http://hallambaker.com/

---

From: Peter Saint-Andre <[email-masked]>
Date: Tue, 11 Jun 2013 10:20:20 -0600

On 6/11/13 5:47 AM, Phillip Hallam-Baker wrote:
> The big problem I have found with using JSON for crypto is the lack
> of a binary encoding for data.

Is this json-discuss or the JSON WG list? Binary encodings are way out
of scope, IMHO. Please let's focus on the task at hand.

Peter

- -- 
Peter Saint-Andre
https://stpeter.im/

---

From: Richard Barnes <[email-masked]>
Date: Tue, 11 Jun 2013 12:29:05 -0400

+1

On Tue, Jun 11, 2013 at 12:20 PM, Peter Saint-Andre <[email-masked]>wrote:

> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG/MacGPG2 v2.0.19 (Darwin)
> Comment: GPGTools - http://gpgtools.org
> Comment: Using GnuPG with Thunderbird - http://www.enigmail.net/
>
> iQIcBAEBAgAGBQJRt05EAAoJEOoGpJErxa2pAjsP/3Ez0/T/+3D6SzJZe4pRgxbB
> gMPLbtTrs+SGbJh4zakepeYp98LyE9Ld+H/ax9eF89HmlfLUWjLuYXdZvcQnSFDF
> CaeTzFbz4s7Q6V7ZZzQvyOguIY456goP5DUxA7tb0gNnGt/gTZQrsvCZmm231gfD
> Fh416M1fUcTONuzIteP8KigidoYicfdmrokLBMFcMR1dqXpUmreucnI9+AmOjR19
> jl1J2b5geHZbS60U1DwEQQ52hcb0hzwDJyhD4vxPG1hEtNWJlwNI/T+gMHVCncAI
> iP7RgYaTd9XQaXmUxwECdUBeBN7ZpYfqvTwi/8qq9aNR+O0vaYS5dV+lHxceUlpF
> EiwfDbB/NzySNW89iyoBsfiJp0q57+4JNGyLNDCNZGPqJXUrN20ZrXPpJ3gdSfEJ
> fwr1FMuhtmST1zNWvTJ4ZgHgYjNII1/KlltkoQ/ZVjvCJReGhG53jWIi72lWaH8I
> eVegeTdX95PYxcQHZiQFCBU0ohu4ogMBFJdYFeLYcpfzeXFICyBNWUbs7RHccAVp
> RN8svEntxVwxPPan4MVkqSbtP59PmvLbyCXle/GYmWBAfzXWwJyw0VLQaLSIFOZK
> W+dxLAuSk6hF0ivVpOMu0YbsSfjrMesdBKrc56Rrpr9s0vs5jVLb2MCd6Adz3pXU
> vjNLNyw2mE9wbhd7/Ie4
> =I+6N
> -----END PGP SIGNATURE-----
> _______________________________________________
> jose mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/jose
>

---

From: "Jim Schaad" <[email-masked]>
Date: Tue, 11 Jun 2013 10:14:20 -0700

<chair>

At this point only the fact that binary encodings exist is in scope for the
WG.

Any concreteness would require a charter modification.

Jim

> -----Original Message-----
> From: [email-masked] [mailto:[email-masked]] On Behalf Of
> Peter Saint-Andre
> Sent: Tuesday, June 11, 2013 9:20 AM
> To: Phillip Hallam-Baker
> Cc: [email-masked]
> Subject: Re: [jose] Binary encoding for JSON
> 
> > The big problem I have found with using JSON for crypto is the lack of
> > a binary encoding for data.
> 
> Is this json-discuss or the JSON WG list? Binary encodings are way out of
> scope, IMHO. Please let's focus on the task at hand.
> 
> Peter
> 
> - --
> Peter Saint-Andre
> https://stpeter.im/
> 
>

---

From: Peter Saint-Andre <[email-masked]>
Date: Tue, 11 Jun 2013 11:18:18 -0600

On 6/11/13 11:14 AM, Jim Schaad wrote:
> <chair>
> 
> At this point only the fact that binary encodings exist is in scope
> for the WG.
> 

Oh, sorry, I got confused between [jose] and [json]. I need to send
those to different folders...

Peter

- -- 
Peter Saint-Andre
https://stpeter.im/

---

From: Phillip Hallam-Baker <[email-masked]>
Date: Wed, 12 Jun 2013 15:52:34 -0400

> Any concreteness would require a charter modification.

Any concrete would needs be added in apps area in any case.

The reason for raising it here was simply to make people aware that there
is a binary option and to encourage anyone who might be interested in
making sure that it is suitable for use with JOSE to take a look to check
if anything was left out.

I would like to be able to use JOSE as an alternative to CMS at some point.
But not with the Base64 penalty.

---

From: Richard Barnes <[email-masked]>
Date: Wed, 12 Jun 2013 16:09:00 -0400

Conversely, there's some discussion right now about how to make JOSE
suitable for a binary-capable encoding:
<http://www.ietf.org/mail-archive/web/jose/current/msg02493.html>

On Wed, Jun 12, 2013 at 3:52 PM, Phillip Hallam-Baker <[email-masked]>wrote:

> On Tue, Jun 11, 2013 at 1:14 PM, Jim Schaad <[email-masked]>wrote:
>
>> <chair>
>>
> I would like to be able to use JOSE as an alternative to CMS at some
> point. But not with the Base64 penalty.
>
> --