3 ms·
Also: For each key you use, pick 1 format of messages for it to authenticate. Document that format. Version-control that documentation along with the code that
by arielby 11y ago
Also:
For each key you use, pick 1 format of messages for it to authenticate. Document that format. Version-control that documentation along with the code that uses it. If the format changes in a non-back-compat way, pick a new key (so try to use a backwards-compatible format). Ensure the documented messages make sense (try not to have a "fire this person" message without knowing who is that person) - timestamps and/or nonces can really help here.
If you can't pick just 1 format, you can say have the first 16 bytes of the message be a UUID, and document each UUID-format (with the same documentation rules as if you are not using a UUID).
Seriously, that and "don't mix secret and unauthenticated things" together covers 90% of all vulnerabilities.