Bug #79677 [Fbk->NoF]: sm2 curve public key encrypt->key type not supported in this PHP build
| From: | php-bugs at lists dot php dot net | Date: | Sun, 21 Nov 2021 04:22:13 +0000 |
| Subject: | Bug #79677 [Fbk->NoF]: sm2 curve public key encrypt->key type not supported in this PHP build | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-237890@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=79677&edit=1
ID: 79677
Updated by: php-bugs@lists.php.net
Reported by: 1055358033 at qq dot com
Summary: sm2 curve public key encrypt->key type not supported
in this PHP build
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: OpenSSL related
Operating System: ubuntu 16.04
PHP Version: Irrelevant
Assigned To: cmb
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2021-11-09 09:24:12] cmb@php.net
> PHP Version 7.1.33-15+ubuntu16.04.1+deb.sury.org+1
PHP 7.1 is no longer actively supported for roughly three years.
Do you still experience this issue with any of the actively
supported PHP versions[1]?
[1] <https://www.php.net/supported-versions.php>
------------------------------------------------------------------------
[2020-06-05 08:09:19] 1055358033 at qq dot com
Description:
------------
---
From manual page: https://php.net/book.openssl
---
-----to begin with: sorry to bother, Im not sure this is a bug or i just get it wrong, i notice that
there is two bug report look like mine, but why answer is between this problem will fixed in 5.6+
and openssl not support ec key...? and i really dont know who to turn to for this, appreciate it if
you can answer me.
env: PHP Version 7.1.33-15+ubuntu16.04.1+deb.sury.org+1 openssl-1.1.1g
public/private Key generate by those commands:
./openssl ecparam -genkey -name SM2 -out priv.key
./openssl ec -in priv.key -pubout -out pub.key
then:
$pubKey = openssl_pkey_get_public('file://path/pub.key');
openssl_public_encrypt($data, $encrypted_data, $pubKey);
I tried to print $pubKey, nothing wrong here,
and this come out:
openssl_public_encrypt(): key type not supported in this PHP build!
openssl_get_curve_names() to make sure sm2 curve is supported, and it is.
in the end: really thanks if you can answer me this, plz let me know if I do
it the wrong way, thanks. below are my public/private Key
my publicKey=========->:
-----BEGIN PUBLIC KEY-----
MFkwEwYHKoZIzj0CAQYIKoEcz1UBgi0DQgAE/J1aKDMqqIpVaudSK0XA/TfC4IFv
MYl2C5VQzCDpvSu6TPW4j8JzrvZg1fsuYhqbvdfFcNGHWLJ1jMNALGFtSg==
-----END PUBLIC KEY-----
my privateKey========->:
-----BEGIN EC PARAMETERS-----
BggqgRzPVQGCLQ==
-----END EC PARAMETERS-----
-----BEGIN EC PRIVATE KEY-----
MHcCAQEEIG8ejJ9q4va/aFwihqPNC6AooKwcV85/DlcCQpGiXCLyoAoGCCqBHM9V
AYItoUQDQgAE/J1aKDMqqIpVaudSK0XA/TfC4IFvMYl2C5VQzCDpvSu6TPW4j8Jz
rvZg1fsuYhqbvdfFcNGHWLJ1jMNALGFtSg==
-----END EC PRIVATE KEY-----
Test script:
---------------
public/private Key generate by those commands:
./openssl ecparam -genkey -name SM2 -out priv.key
./openssl ec -in priv.key -pubout -out pub.key
$pubKey = openssl_pkey_get_public('file://path/pub.key');
openssl_public_encrypt($data, $encrypted_data, $pubKey);
Expected result:
----------------
publicKey encrypted data
Actual result:
--------------
openssl_public_encrypt(): key type not supported in this PHP build!
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=79677&edit=1