Remix.run Logo
EPWN3D 5 hours ago

> Before signing, the encoder fills the field with a placeholder (0), repeated for the field's exact length - signs the entire payload including that placeholder, and then writes the real signature over the top of it. To verify, you put the placeholder back.

I hate shit like this. Do not let your crypto layer know about the structure of what it's signing. Keep security stupid.

woodruffw 5 hours ago | parent | next [-]

As far as compact encodings go, this kind of patch-and-fill technique isn't particularly egregious. The alternative mentioned (where the verifier has to be aware of a bitfield that defines the to-be-signed elements) is much easier to mess up!

lazide 5 hours ago | parent | prev [-]

Counterpoint - every real world crypto algo needs to do somewhat content aware padding or the crypto is much easier to break. Either that, or go so overboard on randomness that it adds a lot of overhead.

When you look at the details underneath more crypto, there is a lot of ah hah - and ‘doh’ - moments due to implementation realities.