AES-GCM-SIV: AES-GCM with some forgiveness
imperialviolet.org
imperialviolet.org
I wish the library support were better (e.g. common java libs), and that it would get added to approved cipher lists from various govt. bodies. I'm not across how this really happens so no idea if it will, but I really hope it does.
I like how hard to get wrong SIV mode is, and how, as a primitive, it lines up quite well with how developers think encryption works before they go do coursera or the matasano challenges or whatever.
In my experience developers don't really get better (as an entire class of people) at security, most of the improvements in security I've seen, I attribute to better APIs and outsourcing of low level infrastructure to highly resourced entities.
Yeah so it's a bit slower and your data has to fit in memory, but within these application caveats I see no reason not to universally prefer automatic IV modes.
You still have to care that its deterministic in a lot of applications but thats not too hard to communicate.
And there is nothing wrong with that, IMO. (Disclosure: I've been immersed in the security field since early 1990's.)
Security is complex - stupefiengly complex. No other field in all of CS has to worry about catastrophic failure modes that can be both subtle and completely invisible. Unless you have teams(!) of professionals working on security full time, you have only marginally better chances of survical than a snowball in the tropics.
Add the fact that most of the time, security is seen as a lack of something. Mostly usability. People who have work to do will find ways to subvert any and all security measures if doing so makes their life easier.
We must accept the fact: it is impossible to sell security. But it IS possible to sell convenience. Make the secure option more convenient than the insecure one, and you can't keep people away.
In other words: improve the APIs. Make the underlying infrastructure secure and provide a convenient way of using it properly. Don't try to fight human nature. Make use of it instead.
One recent example I encountered: if I'm generating an ed25519 ssh key, how many KDF rounds should I use? I've seen some guides drop the flag completely, which apparently defaults to 16. But in other places I've seen people saying it should be 100. Is the default value sane or not?
HTTP/2 does not enforce TLS, only the browser implementations do.
Can you define convenient? Do you mean convenient from a usability perspective, or convenient from a risk/financial consequence perspective?
I would assume you're using the first definition if you just leave it undefined. But strictly speaking, convenience and security are inherently at odds under the first definition; as stated I don't find that this approach generally works. Security features don't really augment usability so much as they trade off some of it - at best, if you were to make the functionality incredibly seamless and abstract away much or all of the decision making, I suppose you could make secure software as usable as insecure software, but it's not straightforward to design secure software to be as enjoyable to use as insecure software.
If we take the example of iMessage: iMessage's security features do not make it intrinsically more or less usable in a general sense; the usability features are those that differentiate it from SMS. Apple happily baked strong cryptography into the protocol as well. An iMessage with the usability features but without the strong cryptosystem would be as useful, and users wouldn't generally be aware of a difference (in fact, it would technically be faster, so in that sense it would more usable).
We can't add any further significant security services to iMessage without meaningfully reducing its usability. If iMessage were implemented as a protocol with end-to-end encryption, it would inherently be less usable due to key management and analytics costs on the client-side.
This is why I take the position that security and usability are diametric opposites in software design. I've never observed software where this is not the case, unless you contrive the definition of "usability" to mean something like, "the user is hacked less, so they can use the application more" (and I've seen people apply this kind of thinking).
I don't see how security and usability can be opposites. They are in conflict with each other to an extent, but increasing security doesn't necessarily hurt usability or vice versa. There are many products which have become both more usable and more secure over time, or which are both more usable and more secure than their competitors.
Sorry, let me be more precise: iMessage is not a true "zero knowledge" protocol construction - Apple could, theoretically, port your iMessage history to another iPhone without using your device's private key or iCloud password. This might be helpful to read: https://blog.cryptographyengineering.com/2013/06/26/can-appl...
> I don't see how security and usability can be opposites. They are in conflict with each other to an extent, but increasing security doesn't necessarily hurt usability or vice versa. There are many products which have become both more usable and more secure over time, or which are both more usable and more secure than their competitors.
Let me try to formalize it a bit. Security is offered through confidentiality, integrity or authentication (increasingly integrity is just a sub-feature of authentication). Before you add authentication, a user might have been able to access their data or account somewhere without needing to log in. But access control was required, so now they need to enter a password, which requires password management of some kind.
When you add a security service, what capabilities in the application are now impossible, or more difficult? Maybe those capabilities were undesirable or negligible, but they were there; by removing those capabilities you have added a cost, or a friction in its place. A possible workflow has been diminished, even if its for good reason.
In practice you can reduce the impact of these quite a lot, i.e. encrypted messaging doesn't have to be PGP, it can be like iMessage. But fundamentally security (or cost) and usability have been transacted.
I agree that the two are generally in tension, but I don't think they're opposites, and they don't always fight. Consider, for example, switching from a plaintext network protocol to one that uses encryption with an unauthenticated key exchange. The result isn't particularly secure since it's vulnerable to a MITM attack, but it's a definite improvement since it shuts down passive snooping, and it doesn't impact usability at all.
Or consider something like HSTS. You shut down a real avenue of attack and the user never even sees the difference.
Of course.
I mean convenient from the user's perspective, whether that is the developer (APIs, libraries, etc.), or the end user (workflow, UX, etc.); make the usability of the secure option/behaviour more appealing and you've guaranteed that human nature will take care of the rest.
I'm not saying it's easy.
What you're talking about is a different implementation of crypto_box, which uses AES-GCM with tag included along with ciphertext.
It would be nice to be able to be a little less careful, and also we're likely moving to an MCU without onboard byte-writeable EEPROM (ie page-write Flash with 1/10th the endurance), and this approach may make that less painful.
https://github.com/opentrv/OTAESGCM
(It also compiles and runs on our x64 machines, Linux and macOS.)
My point is just: there are reasons beyond nonce misuse safety to avoid GCM, especially on IOT devices.
AES-GCM seemed the best available choice for us, after much discussion, and some scrutiny from third parties.
I hear you on timing issues: we may work on those, though when it comes to AVR there is no cache! B^>
The cache thing is a good point!
But the same idea can still be applied to ChaCha. See https://github.com/jedisct1/libhydrogen/wiki and https://github.com/codahale/xsalsa20poly1305 for example.
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.
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).
The trapdoor function of genius: ideas which are very difficult to identify, but very easy to recognize.
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.
- 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.
Also, yes.
(I defined and implemented a variant of Adam's idea with NaCl secretboxes: https://github.com/dchest/nacl-stream-js)