3 ms·
I'm not going to say don't write crypto. Instead I will give more useful advice: if you do write crypto, make it boring. Really boring. Do not invent anything.
by api 10y ago
I'm not going to say don't write crypto. Instead I will give more useful advice: if you do write crypto, make it boring. Really boring. Do not invent anything. Do not be creative. Use an established modern construction with modern ciphers and use them in only one way. That one way should be the way cryptographers recommend with no deviations.
- CiPHPerCoder 10y agoIn a previous discussion: https://news.ycombinator.com/item?id=10345965 https://news.ycombinator.com/item?id=10345965
- tptacek 10y agoThe crypto in Magento is extremely boring. In fact: it's too boring. It predates misuse-resistant interfaces like Nacl. It's not enough to be boring: you have to be the right amount of boring. I was joking 10 years ago when I wrote "if you're typing A-E-S into your code you're doing it wrong", but more and more I feel like I was on to something.
- treve 10y agoWhat would be a good, boring, way to do encryption with PHP in 2016?
- dguido 10y agohttps://github.com/jedisct1/libsodium-php https://github.com/jedisct1/libsodium-php https://paragonie.com/book/pecl-libsodium https://paragonie.com/book/pecl-libsodium Docs happen to be written by the OP too...
- reitanqild 10y agoFWIW if I read correctly our own CiPHPerCoder in this thread is Scott Arciszewski from paragonie. I often find his posts interesting and sometimes a welcome adjustment to some long-running counterproductive memes.
- CiPHPerCoder 10y agoYes, I am Scott. And thank you. :)
- hannob 10y agoUse an AEAD. Learn that PHP doesn't support an AEAD. Wait for PHP 7.1... I recently covered this a bit when I looked at owncloud's crypto: https://blog.hboeck.de/archives/880-Pwncloud-bad-crypto-in-the-Owncloud-encryption-module.html https://blog.hboeck.de/archives/880-Pwncloud-bad-crypto-in-t... The situation is far from ideal. Recommending libsodium-php is also not as simple, as this requires an additional thing to be installed on a server, which probably isn't the case for most shared hosting environments.