Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:126394 X-Original-To: internals@lists.php.net Delivered-To: internals@lists.php.net Received: from php-smtp4.php.net (php-smtp4.php.net [45.112.84.5]) by qa.php.net (Postfix) with ESMTPS id F2B491A00BC for ; Thu, 13 Feb 2025 15:14:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=php.net; s=mail; t=1739459519; bh=ERWQcH1+XPFBltNZPTaN//F5/+AbDO5aG9yqhPCq3xg=; h=Date:Subject:To:References:From:In-Reply-To:From; b=di+IFpZzlVHRFSy61Val06yhHxSVypQDzuoqh3s+T6jCqr40Dqv+jfJYUyZys8euB K9GlM85ufwqnmVgAmpnpRs4jXWUot/buqgwJuFG04etCVsO8i9x/mcO1RI86kC70AB CXEN9d3WlW0KvOUjL0xRbXK7LPBUdN/pgOjhwfG7t1PS7UjOb06c7qFuIXJjUC8Qh+ ylex7DLHBd3JUT51FNtkTt4gUYGNAcL4mlQs++8IK9FJJtrCdYPPLvjjNcvDQGqQ0y PxiD3HHZhAVrPpAcvvJxMJprQy30McB9Bk6pGeZLf4blk3YSSeoobJnT9cjRcR70Kl FBBgGYsYz1yTQ== Received: from php-smtp4.php.net (localhost [127.0.0.1]) by php-smtp4.php.net (Postfix) with ESMTP id CBF811801D6 for ; Thu, 13 Feb 2025 15:11:57 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 4.0.0 (2022-12-13) on php-smtp4.php.net X-Spam-Level: **** X-Spam-Status: No, score=4.7 required=5.0 tests=BAYES_50,DMARC_NONE, HTML_MESSAGE,SPF_HELO_FAIL,SPF_SOFTFAIL autolearn=no autolearn_force=no version=4.0.0 X-Spam-Virus: No X-Envelope-From: Received: from box.sixthree.me (box.sixthree.me [52.24.245.86]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by php-smtp4.php.net (Postfix) with ESMTPS for ; Thu, 13 Feb 2025 15:11:55 +0000 (UTC) Authentication-Results: box.sixthree.me; dkim=none; dkim-atps=neutral Received: from authenticated-user (box.sixthree.me [52.24.245.86]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by box.sixthree.me (Postfix) with ESMTPSA id A635E7E371 for ; Thu, 13 Feb 2025 07:14:37 -0800 (PST) Content-Type: multipart/alternative; boundary="------------9oOwvykugvrm0wrMD7wbdkWv" Message-ID: <0f534d3b-73f3-4d04-b955-4a2093473376@php.net> Date: Thu, 13 Feb 2025 07:14:37 -0800 Precedence: bulk list-help: list-post: List-Id: internals.lists.php.net x-ms-reactions: disallow MIME-Version: 1.0 Subject: Re: [PHP-DEV] Update OpenSSL Extension to Support KEMs To: internals@lists.php.net References: Content-Language: en-US Autocrypt: addr=ericmann@php.net; keydata= xsFNBFg4q4YBEAD50HOLDAVpW88rUHnX/TYTCLpqmHMKXPjuf1l3ZEkY3PXF6wqmqaWWMPeW JFsik3cMebtLQzsgXHl4xDUBQhOOtdfax2ZKBHQmoUknw2dKkqdkVLh8Xpu8tw00SmcTiAFV CA2+HOqQ+Drq9NUpnMeJpJZiZu84eZbJBEzgabi0s4jf67NH7E3ENFb8DRilcM1aNT0rD1xV KR1spMKmBmOoJ/pj5OlWNH34/qdeqIrvKB46/pFELH8SRiorYTDhQTaS0PlT3LxRqVWo8+Jl gnFIe96p2d7JF1A1DwQUJerRY4789gNYzjW4fh1tc6jtTE2opbLVfbqujHsxrHFKoBO4CPBc Ptzf6TUPxDevvBh9omsd+V5FW7k/VFIiWFQv0RfQe8nwkNjmA0U3TOX3xKrU+59RU6w+uOuQ y564jxg691a7peiQ2Y90FqIVUlEL9Guf8U9ezp1DGo/UhnRNJcPmSwhYRcKMUV53mDqWQW8p 7XXjSqnVVF3cP9bc94UNAf28kXvnJBMGOZwp19dqD7ws+25WM6qQ7u7qQoGZzSI4W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GURWosoAKpLbeUGd9/zO f253g3XoN13wwTKyjhXKENUPw8ZqvjdPO+tgNnOLUnPO6K10ePbW4vaZdFCdixumxqZPokeB PkBPZq8oeAswkgWahKwQ7ZfgU4HTLMte3NEn/2WZQsLUo68IMaTCKt3AHvGoYi86wtd6/3Db NMxNsWamr8SWzia/1DGM5F1o3ClrZetD+eZN13duF3gI/1x+++5LhWP+qxPPOzBhXZG5zJ2P 3+eRwWuS79ZGfoh6w7uF4A3rkjkKfpAIwrNI2WlAKXWdBQ== In-Reply-To: From: ericmann@php.net This is a multi-part message in MIME format. --------------9oOwvykugvrm0wrMD7wbdkWv Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 2/13/25 06:51, Paragon Initiative Enterprises Security Team wrote: > OpenSSL 3 introduced a KEM API, which is an abstraction for the kinds > of cryptographic operations used by the NIST post-quantum cryptography > standards (i.e., FIPS-203). > > KEM stands for "Key Encapsulation Mechanism". It's the preferred way > to do asymmetric cryptography. Even RSA-KEM is safer than how most > people experience RSA encryption. > > The relevant functions are EVP_PKEY_encapsulate() and > EVP_PKEY_decapsulate(). > > https://github.com/openssl/openssl/blob/4b4333ffcc8e4ecbf5c70214769c77c7a1bb684f/crypto/evp/kem.c#L225 > > https://github.com/openssl/openssl/blob/4b4333ffcc8e4ecbf5c70214769c77c7a1bb684f/crypto/evp/kem.c#L262 > > Currently, these APIs only seem to support classical cryptography > (ECC, RSA), but that is one of the APIs that will enable post-quantum > cryptography for software using OpenSSL in the future. > > We intend to send a pull request later this year to include PHP > functions in the OpenSSL extension that look like this: > > function openssl_kem_encaps(OpenSSLAsymmetricKey $pk): array; >   // 0 -> shared secret (typically 32 bytes) >   // 1 -> KEM ciphertext for decaps > function openssl_kem_decaps(OpenSSLAsymmetricKey $sk, string > $kemCiphertext): string; >   // Returns a shared secret or throws an exception upon decryption > failure. > > I don't know if this change needs an RFC or not, but I wanted to start > the discussion just in case. > > Security Team > Paragon Initiative Enterprises -- I, for one, would love to see this land and also view it as natural evolution of support for OpenSSL within PHP. Which is to say, I don't think an RFP would be necessary here and we should just work to add this support moving forward. --------------9oOwvykugvrm0wrMD7wbdkWv Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: 8bit
On 2/13/25 06:51, Paragon Initiative Enterprises Security Team wrote:
OpenSSL 3 introduced a KEM API, which is an abstraction for the kinds of cryptographic operations used by the NIST post-quantum cryptography standards (i.e., FIPS-203).

KEM stands for "Key Encapsulation Mechanism". It's the preferred way to do asymmetric cryptography. Even RSA-KEM is safer than how most people experience RSA encryption.

The relevant functions are EVP_PKEY_encapsulate() and EVP_PKEY_decapsulate().



Currently, these APIs only seem to support classical cryptography (ECC, RSA), but that is one of the APIs that will enable post-quantum cryptography for software using OpenSSL in the future.

We intend to send a pull request later this year to include PHP functions in the OpenSSL extension that look like this:

function openssl_kem_encaps(OpenSSLAsymmetricKey $pk): array;
  // 0 -> shared secret (typically 32 bytes)
  // 1 -> KEM ciphertext for decaps
function openssl_kem_decaps(OpenSSLAsymmetricKey $sk, string $kemCiphertext): string;
  // Returns a shared secret or throws an exception upon decryption failure.

I don't know if this change needs an RFC or not, but I wanted to start the discussion just in case.

--
I, for one, would love to see this land and also view it as natural evolution of support for OpenSSL within PHP. Which is to say, I don't think an RFP would be necessary here and we should just work to add this support moving forward.
--------------9oOwvykugvrm0wrMD7wbdkWv--