4 ms·
To answer my own question, this is a good resource: https://www.lvh.io/posts/nonce-misuse-resistance-101.html https://www.lvh.io/posts/nonce-misuse-resistance-
by StavrosK 9y ago
To answer my own question, this is a good resource:
https://www.lvh.io/posts/nonce-misuse-resistance-101.html https://www.lvh.io/posts/nonce-misuse-resistance-101.html
In summary, it makes the nonce a function of the message as well, so you always get the same nonce for the same message. Presumably, the attacker only sees duplicate messages rather than plaintext because XORing a message with itself yields zero.
This is one of the things that make you ask "why didn't I think of that?" when you hear of them, and I think that's generally the mark of an ingenious idea.
- therein 9y agoI think the most ingenious implication of what you're describing is that as a side effect, it is therefore guaranteed that no two distinct message will have the same nonce.
- StavrosK 9y agoI think that's the point, not a side effect, though. It only seems to prevent nonce reuse, not collisions for small nonce lengths, but I guess that's what they set out to fix, as it's the more common problem. I guess the reasoning went something like: "How do we prevent reusing the same nonce for two different messages? XOR a hash of the message with the nonce" (I'm not sure this is actually how it works, I haven't looked). Obvious in retrospect, like all great ideas.
- kobeya 9y agoSo it wouldn't work for stream encryption then?
- problems 9y agoDepends how your stream encryption is done and what you mean by stream encryption. - If you mean encryption of messages using a stream cipher, generally a single IV is used per message so it could be used there. - If you mean encryption of a stream of data, well, if you're using a block cipher to encrypt a stream of data, this indeed could be used as a block cipher inherently creates blocks in the data every X bits. - However, if you're encrypting a stream of data using a stream cipher it is indeed impossible as all data in the stream isn't known when encryption begins.
- kobeya 9y agoI mean encryption of data as it is generated, in a single pass. This entire message is not known, so unless I am misunderstanding, it is not possible to do per-message deterministic nonce generation.
- dom0 9y agoGenerally speaking, streaming AEAD is discouraged on an API level, because it incentivises using unauthenticated intermediate decryption results. Thus, block the data into reasonably sized blocks. Also, yes.
- dchest 9y agoThe author of the linked blog post has a post exactly about this: https://www.imperialviolet.org/2014/06/27/streamingencryption.html https://www.imperialviolet.org/2014/06/27/streamingencryptio... (I defined and implemented a variant of Adam's idea with NaCl secretboxes: https://github.com/dchest/nacl-stream-js https://github.com/dchest/nacl-stream-js)
- tptacek 9y agoNo: you can't use SIV "online".
- stouset 9y agoThe ideas behind SIV are pretty straightforward, and I don't suspect many in the field think it's not an obvious idea. The hard work is in finding a way to build a mode that minimizes the downsides as much as possible (so it can be used widely) and in proving that the construct doesn't violate any expectations or guarantees of the mode it's replacing. A lot of cryptography required a stroke of brilliance to come up with an idea and see it through. AES-GCM-SIV just required putting in the hard, tedious work (this is very much not meant to undersell the effort involved, just to emphasize that the hard part here was labor, not ideas).
- dsacco 9y ago> This is one of the things that make you ask "why didn't I think of that?" when you hear of them, and I think that's generally the mark of an ingenious idea. The trapdoor function of genius: ideas which are very difficult to identify, but very easy to recognize.