Open
Description
Description
The following code:
<?php
$public_key = openssl_pkey_get_public(file_get_contents('sm2pubkey.pem'));
$d1 = openssl_pkey_get_details($public_key);
var_dump($d1);
Resulted in this output:
["dh"]=>
array(1) {
["p"]=>
}
["type"]=>
int(2)
But I expected this output instead:
["ec"]=>
array(5) {
["curve_name"]=>
string(9) "sm2"
["curve_oid"]=>
["x"]=>
["y"]=>
["d"]=>
}
["type"]=> int(3)
my openssl ext info
OpenSSL support => enabled
OpenSSL Library Version => OpenSSL 3.0.2 15 Mar 2022
OpenSSL Header Version => OpenSSL 3.0.2 15 Mar 2022
Openssl default config => /usr/lib/ssl/openssl.cnf
Directive => Local Value => Master Value
openssl.cafile => no value => no value
openssl.capath => no value => no value
the sm2pubkey.pem generate command
openssl ecparam -name SM2 -genkey -noout -out sm2-key.pem
openssl ec -in sm2-key.pem -pubout -out sm2pubkey.pem
PHP Version
8.1.2
Operating System
Ubuntu 22.04.1 LTS