Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:90466 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 42781 invoked from network); 10 Jan 2016 21:48:17 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 10 Jan 2016 21:48:17 -0000 Authentication-Results: pb1.pair.com smtp.mail=rowan.collins@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=rowan.collins@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 74.125.82.54 as permitted sender) X-PHP-List-Original-Sender: rowan.collins@gmail.com X-Host-Fingerprint: 74.125.82.54 mail-wm0-f54.google.com Received: from [74.125.82.54] ([74.125.82.54:38225] helo=mail-wm0-f54.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 32/B1-14657-F91D2965 for ; Sun, 10 Jan 2016 16:48:16 -0500 Received: by mail-wm0-f54.google.com with SMTP id b14so242507006wmb.1 for ; Sun, 10 Jan 2016 13:48:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-type:content-transfer-encoding; bh=EbFQnNfmBplQ2mxv2uVobXc7lltxCZRYQ84cNNuoawQ=; b=eNKkKhToEaOf2S9Zt/+5jlRzb3jO9N6O9R656nxnzWYBhpjPpWHO9HMudM3zPjwn+J SnaQwaP+cgywcKYqvEYsKwsKWOuJ35bLSV5ooUfxd2NqxpDMOyS6ORm22pTfO9paCEiN D40vBpX6KdhwlIHBqV2x3ffFccnEDNL7QOlklXRuFUjeAM4vzQthMHu6Kjx3w2RZU/ot bkXX455f325gcjXSYFoEsfMPKBxAOYwIPP2qH4n0QHXYLc5ZaSka1yHnrPcMW6+ZNiLv 0h1TMvNOPLocyAv192iqmezDWgGguuPPJyzsOI0NhEcCfwpLAcgHEi0XWZn4WszCu19N zTGw== X-Received: by 10.194.116.71 with SMTP id ju7mr29806064wjb.2.1452462492794; Sun, 10 Jan 2016 13:48:12 -0800 (PST) Received: from [192.168.1.189] ([2.31.24.87]) by smtp.googlemail.com with ESMTPSA id t9sm62299815wjf.33.2016.01.10.13.48.11 (version=TLSv1/SSLv3 cipher=OTHER); Sun, 10 Jan 2016 13:48:12 -0800 (PST) To: Scott Arciszewski , PHP Internals References: <5692B742.5030303@gmail.com> Message-ID: <5692D18B.6000308@gmail.com> Date: Sun, 10 Jan 2016 21:47:55 +0000 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101 Thunderbird/38.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] PHP 7.1 - Simple Cryptography Interface From: rowan.collins@gmail.com (Rowan Collins) Hi Scott, Note: you forgot to copy the list in on your mail. I've not snipped any of your comments, so others can read them. On 10/01/2016 20:08, Scott Arciszewski wrote: > Hi Rowan, >> (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) > Of course. > >> 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. > I'm personally of the opinion that, should you need to integrate with > a specific protocol, you should also be provided a well-studied > library that does that for you by the people you're integrating with, > or otherwise by a cryptography expert in your employment. But what primitives should those well-studied libraries be built on top of? Should every such library have to be distributed as a C extension (annoying for users), or implement low-level bit manipulation in PHP (slow!)? The idea of a "PDO-like" library would be to provide the building blocks for those libraries to work with, so that they didn't have to either reimplement all their own encryption primitives (surely a bad idea) or force a dependency on a particular php extension (which is how mcrypt has become such an albatross). > I wouldn't want to widen the scope here for this project to > incorporate whatever weird requirements other projects have (e.g. > Fernet, with its 0x80 header), because not every protocol is secure. > See also: https://auth0.com/blog/2015/03/31/critical-vulnerabilities-in-json-web-token-libraries/ > > We shouldn't be accepting responsibility for other peoples' mistakes > here, we should instead aim to prevent them. By providing an > opinionated, conservative, and incredibly easy-to-use correctly > cryptography interface, we ensure that projects whose requirements are > "This needs to be encrypted" are easier for neophytes to get correct. > Also, newer protocols can be constructed atop what we provide. In that case, I think this needs to be clearer in the proposal, and even in the name of the extension. Maybe "SimpleCrypto", like "SimpleXML", if that's not already taken? Essentially, this is not a library for doing arbitrary encryption, it is a particular toolkit with its own serialization formats, methods of operation, etc. It's actually a step higher-level than the abstractions other people have been talking about, and could be built on top of it: libsodium (C library) -> pco_sodium (PHP Crypto Objects driver) -> PCO (framework abstracting crypto implementations) -> SimpleCrypto ("an opinionated, conservative, and incredibly easy-to-use correctly cryptography interface"). > Ultimately, one of my broader goals is to develop compatibility > interfaces for other languages (in particular: Node.js, Java, C#, > Python, and Ruby) once we have something in place, to promote > interoperability. (These other libraries would be either MIT, WTFPL, > or CC0 licensed by the way.) This is another good reason to give the extension a snappy name - if you got your way and this extension lived in the \Crpytography namespace, how would you signal that a particular Node.js library was intended to interact with it? Regards, -- Rowan Collins [IMSoP]