Need magic numbers inserted before signing
Before signing any blob of binary data, the data must be prefixed with a byte indicating what type of data it is, and that byte must be incorporated in the signature. It does not have to show up in any other data structure, but is prepended right before signing and right before verifying the signature. (The hardware module, e.g. a Ledger Nano S, will perform both hashing and signing).
The byte will have the following possible values at first:
- 0x00 -- reserved: the hardware module will refuse to sign
- 0x01 -- block header
- 0x02 -- operations that are safe for baking (i.e. endorsements); ones that should be approved by a hardware module in "baking mode" without further prompting
- 0x03 -- operations that are not normal for baking (e.g. transactions)
Eventually, more will be added, see discussion in #ledger.