by _8j50 · 3y ago · 0 comments
Some items that stood out for me after a skim:
- AES-CBC is not unusable, from what I understand with random IV and a good HMAC it is usable?
- "Really, anything RSA", there are protocols that encrypt the key with RSA for key transport and use AES or some other block cipher for the data. As far as I am aware this is safe given the key is derived properly and is not reused. If you have to encrypt using their public key and you are restricted from using EC anything your choices are few.
- Custom transport protocols are sometimes needed. TLS is general purpose which means there are corner cases it can't support once in a whole and you can't always use noise. What are best practices to implement key exchange, manage keys and authentication+integrity?
My feed back is that often people are lazy enough to use a pre-made library but when they can't telling them there is no alternative does not help. But otoh, I get that perhaps going into such detail would make the content of the gist too long.
Since it's highly unlikely than an untrained developer will do all of these correctly, the authors are right, IMHO, to avoid mentioning AES-CBC+HMAC. Yes, it can be implemented safely. So does RSA for that matter. But is it likely that most developers (or let's be generous - even more than 10% of them) will implement this correctly? No.
When you need to roll your own crypto (custom transports, RSA combos for compatibility reasons) you'll just have to get an expert to do that. WireGuard implements its own transport and TarSnap implements its own crypto (on top of RSA, no less!) and you don't see the authors of these documents criticizing them. In fact, TarSnap is consistently recommended in this guide.
But the audience for these best practices is not Colin Percival[2]. It's the average developer who usually has an "Intro to Cryptography" background from their CS Major at the best of times.
[1] I am not aware of any audited library that does this, but Google's Tink offers AES-CTR+HMAC: https://developers.google.com/tink
Oh come on! It's not rocket science, just encrypt and hmac. My point was mentioning that best practicr tip for example will help. People still use aes-ecb because they don't know failing with aes-cbc is better.
> When you need to roll your own crypto (custom transports, RSA combos for compatibility reasons) you'll just have to get an expert to do that
If someone is in a position where they're choosing ciphers and they're not an expert, chances are they won't get funds to hire an expert and they can't tell their boss or customer they can't do it. Help people not shoot their own foot off is all I am saying.
I agree with the audience part. The average dev also does not work in silicon valley or in a FAANG. They work in bigcorp,consulting or government where you do your best with unreasonable requirements and little cash to spare for third party experts.
Any platform with hardware acceleration for AES should hopefully have a carryless multiplication instruction anyway, so GCM will be fast. And if not, Poly1305 is so fast that another HMAC construction will perform worse. So there’s really no reason not to just use one of these two in 99% of cases.