Subject: [Json] Canonicalized JSON

From: Anders Rundgren <[email-masked]>
Date: Sun, 8 Nov 2015 16:59:28 +0100

Canonical JSON would [probably] be cool but it isn't a reality.

Anyway, I have continued the quest into ES6 and the canonicalization of Numbers
and AFAICT [1] a bunch of ES6-vendors [2] have selected algorithms [3] that produce
deterministic and interoperable values for serializing and deserializing Numbers.

That is, no workarounds of any kind are necessary for using in-object JS or JSON signatures
like the JS-example below which was created by my just updated reference implementation:

var reading =
{
   device: "Pump2",
   value: 13000,
   signature:
     {
       algorithm: "ES256",
       publicKey:
         {
           type: "EC",
           curve: "P-256",
           x: "ajlL4ksVEi-T589G7X9H4VOLoqbMkzPQw_GQFvUIXMA",
           y: "BdNg_sfSs6cZsYiMoRSmvnFOHXHJhYf9adQTkP1yweA"
         },
       value: "VMbKgogiOeoWQd7tT9_vqNVxUm0fg7phsITvfj6Ggd_ghYj0BzW30QOS69tiYL0tTIEMVI4Kf9ZnQUocrr7XYQ"
     }
};

1] Test-file with specific values as well as random numbers.  10 million total:
http://webpki.org/ietf/es6testfile.txt

2] Google (Chrome), Mozilla (Firefox), and Apple (Safari).

3] https://github.com/cyberphone/openkeystore/blob/master/library/src/org/webpki/json/DToA.java

- anders