[RFC] PHP 7.1 - Simple Cryptography Interface

php.internals

Scott Arciszewski

10 years ago
I'd like to make cryptography drop-dead simple in PHP 7.1 and thereafter. The simplest thing to do is to provide a simple front-end API, designed for human usability, that abstracts away the complexities of cryptography engineering. I've started writing an RFC draft here: https://wiki.php.net/rfc/php71-crypto These are the rules I'd like everyone to keep in mind when proposing changes to these features: 1. Security is the first priority. It is absolutely unacceptable to add a cryptographic side-channel or render this library vulnerable to any sort of chosen-ciphertext attack.ECB mode is completely off the table. 2. Simple is good. Developers should not need to know what a nonce is, nor should they be given the opportunity to weaken the protocol by providing their own. Some general guidelines that I feel particularly strong about but others might contest: For 7.1, we will only allow elliptic curve public key cryptography. In the future, we might expand to include post-quantum cryptography. We must absolutely not support RSA or classic (non-EC) Diffie Hellman. This is the overall process I'd like to follow for getting this ready for PHP 7.1. 1. Develop a PHP extension, available in PECL, so developers can implement it in PHP 7.0 projects to test it out. This process starts today. I've set up a GIthub repository at https://github.com/paragonie/php71_crypto for any developers that would like to help. 2. The RFC/voting process. This starts as soon as we have a stable implementation and drivers for both libsodium and openssl ready to go. 3. Formal code review from a third-party team of security experts (Depending on how successful I am in my business ventures this year, I might be able to cover the cost of this personally. I can't promise anything today, however.) 4. Merge it into the PHP core before 7.1.0 is released. Everyone is welcome to contribute, even if you're not a cryptography expert. Non-experts are the people I intend to be able to use it, so your feedback will be incredibly valuable. Together, I believe we can make PHP 7.1 the pinnacle of usable security. :) Scott Arciszewski Chief Development Officer Paragon Initiative Enterprises <https://paragonie.com>

Rowan Collins

10 years ago
On 10/01/2016 04:23, Scott Arciszewski wrote:
> I'd like to make cryptography drop-dead simple in PHP 7.1 and > thereafter. The simplest thing to do is to provide a simple front-end > API, designed for human usability, that abstracts away the > complexities of cryptography engineering.
I'm absolutely in favour of the sentiment behind this, but I'd like to clarify the exact audience and use-cases you are targeting. The severely limited set of proposed algorithms sounds great for someone who just wants to implement a single crypto scenario for internal use (although in that case things will need to be very well documented - as a non-expert, I would not know when to use seal() vs encrypt() vs aeadEncrypt() for instance). The custom "ciphertext message format" also implies that the intention is only to store these messages for use on another PHP system with the same configuration. However, some of the time the cryptography work people want to do is to interact with other systems. These might require selection of specific algorithms, which might not be the latest and greatest, but still need to be implemented somewhere. It would be odd if I wanted to implement, say, OAuth or XML-Sig, and there were no functions under \Php\Crypto\ to help me with that. Previous discussions have described something more like PDO, which is intended as a simplified abstraction toolkit, rather than a crypto-for-dummies. I think there's a case for both things, but it would be interesting to think about how they might be related. Regards,
-- Rowan Collins [IMSoP]