News for hackers. Stuff that matters.
Re:Scuttlebot: Peer-to-peer database, identity provider, and... by dboreham on Saturday April 18, 2020 @05:06PM (#22911103)
Any signing done over structured data has this problem. You always need a canonical representation.
Re:Scuttlebot: Peer-to-peer database, identity provider, and... by ben509 on Sunday April 19, 2020 @12:58AM (#22913636)
It would be simpler to work out a canonical reduction for JSON. This should be reasonably easy since there are so few elements to it.

A simple proposal for actual security guys to rip to shreds:

Strings are represented as utf-8 blobs, and hashed.

Numbers should probably be represented using a proper decimal format and then hashed. If you're reading the JSON in and converting it to floats, you could get slight disagreement in some cases.

Arrays are a list of hashes, which itself is hashed.

For objects, convert the keys to utf-8 and append the value (which will always be the hashed representation) and then sort these entries bitwise. And then hash all that.

Or, better, it'd be great to have an order-independent hash function that's also secure. I doubt xoring all the pairs would be good enough. Update: a possible technique[1]

[1]: https://crypto.stackexchange.com/questions/51258/is-there-su...

Re:Scuttlebot: Peer-to-peer database, identity provider, and... by mouldysammich on Saturday April 18, 2020 @05:17PM (#22911160)
could it use a HTTPHeader style system instead to avoid the json serializing back and forth?
Re:Scuttlebot: Peer-to-peer database, identity provider, and... by Vendan on Saturday April 18, 2020 @05:23PM (#22911209)
Just serialize, sign, pack the signature and the raw bytes of the serialization. Doesn't matter how, just gotta pack the raw bytes, not futz with it
Re:Scuttlebot: Peer-to-peer database, identity provider, and... by monocasa on Saturday April 18, 2020 @05:32PM (#22911274)
You can even have a JSON object containing base64 fields for message and signature if you feel it really needs to be JSON all the way down for whatever reason.