<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
> Instead of hashing a stringified version of the `update` object
directly, we could sort an array of the keys in the update object
and
then create an array of key, value pairs in the sorted-key order.<br>
<br>
Presumably, we would also want to recursively sort any sub-objects
in the update object? What encoding do we use to serialize the
update object for signing?<br>
<br>
Your solution is definitely workable, but instead of using new (i.e.
existing) tools, it means inventing our own tools, which are likely
to be underspecified and have unique bugs.<br>
<br>
Here are two alternatives that allow us to specify a signature over
a byte sequence rather than canonicalized JSON:<br>
<br>
1) The first line of the update file is a signature of the following
bytes, up through the first newline. Everything following is valid
JSON, and the signature is determined over those raw bytes. E.g.<br>
<br>
<font face="Courier New, Courier, monospace">uc0mBep1KTsWuJKpfF5LC8GPPa/Qy9+JfIAljVdBXIA=<br>
{<br>
"foo": "bar"<br>
}</font><br>
<br>
2) The signature is not embedded in the JSON at all, but fetched
from another file. e.g. /update.json and /update.json.sig.<br>
<br>
Note that either of these approaches works with
nsIDataSignatureVerifier.<br>
<br>
Relatedly: We will probably want the extension to ping a certain URL
when signature verification fails, so we can keep an eye out for
malfunctions.<br>
</body>
</html>