openssl ext sm2 compatibility
Nobody has claimed this yet.
- Dominant language
- C
- Stars
- 40.4k
- Forks
- 8.1k
- Avg merge
- 2d 13h
- Merged PRs (30d)
- 96
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
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the report with PHP 8.1.2, OpenSSL 3.0.2, and the provided openssl ecparam and openssl ec commands. Start from the openssl_pkey_get_public() and openssl_pkey_get_details() entry points, then compare the returned structure with the expected SM2 EC details. Done means SM2 public keys are reported as EC keys with the expected curve information.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- cryptography, security
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100