Skip to content

Windows builds don't support OPENSSL_KEYTYPE_X25519, OPENSSL_KEYTYPE_ED25519, OPENSSL_KEYTYPE_DSA, etc #21355

@terrafrost

Description

@terrafrost

Description

The following code:

echo OPENSSL_KEYTYPE_X25519, PHP_EOL, OPENSSL_VERSION_TEXT, PHP_EOL;

$key = openssl_pkey_new(['private_key_type' => OPENSSL_KEYTYPE_X25519]);
var_dump($key);

while ($e = openssl_error_string()) {
    echo $e, PHP_EOL;
}

Resulted in this output:

4
OpenSSL 3.5.4 30 Sep 2025
bool(false)
error:80000003:system library::No such process
error:10000080:BIO routines::no such file
error:07000072:configuration file routines::no such file
error:80000003:system library::No such process
error:10000080:BIO routines::no such file
error:07000072:configuration file routines::no such file

But I expected this output instead:

OpenSSL 3.5.4 30 Sep 2025
object(OpenSSLAsymmetricKey)#1 (0) {
}

Because the Windows PHP builds include their own version of OpenSSL (usually the latest one as OPENSSL_VERSION_TEXT kinda indicates) as opposed to relying on whatever the globally installed version on the OS is, I'd expect them to have full support for all key types mentioned at https://www.php.net/manual/en/openssl.key-types.php but that appears not to be the case.

PHP Version

PHP 8.5.1 (cli) (built: Dec 17 2025 10:54:30) (NTS Visual C++ 2022 x64)
Copyright (c) The PHP Group
Zend Engine v4.5.1, Copyright (c) Zend Technologies
    with Zend OPcache v8.5.1, Copyright (c), by Zend Technologies

Operating System

Windows 11, Version 25H2 (OS Build 26200.7840)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions