SM2
为非对称加密,基于 ECC。该算法已公开。由于该算法基于 ECC,故其签名速度与秘钥生成速度都快于 RSA。ECC 256 位(SM2 采用的就是 ECC 256 位的一种)安全强度比 RSA 2048 位高,但运算速度快于 RSA。
openssl_pkey_get_public
— 从证书中解析公钥 , php使用这个函数可以获取 rsa的公钥,sm2证书的一直获取不到,切换php版本,有的可以解析,有的不可以
使用openssl 获取证书 公钥一直报错
php中openssl_public_encrypt进行sm2加密,报错openssl_public_encrypt(): key typ
php中用openssl_pkey_get_public获取不到ecc算法的公钥

php想要进行sm2加密的话,需要使用扩展 例如 GmSSL openssl-ext-sm2
git 地址
https://github.com/GmSSL/GmSSL-PHP
https://github.com/guanzhi/GmSSL/tree/GmSSL-v2
https://gitee.com/state-secret-series/openssl-ext-sm2
参考
https://blog.youkuaiyun.com/markximo/article/details/128124885
https://blog.youkuaiyun.com/weixin_37644303/article/details/140121305
https://gi

最低0.47元/天 解锁文章
3599

被折叠的 条评论
为什么被折叠?



