We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
使用EVP_PKEY_keygen生成了SM2密钥对EVP_PKEY,然后使用接口EVP_PKEY_get_octet_string_param获取公钥,
EVP_PKEY_keygen
EVP_PKEY
EVP_PKEY_get_octet_string_param
EVP_PKEY_get_octet_string_param(pkey, OSSL_PKEY_PARAM_PUB_KEY, pub_key_buf, pub_key_len, &pub_key_len)
Tongsuo返回的公钥是压缩格式的,即以0x02或0x03开头,长度仅为33个字节,如下所示,
0x02
0x03
0375c05a9371f2ced4573fb2cfd10a36c00294f34582bcba257817b973902a81c5 02c1be22935ed71a406e2b1b3e5f163582e016fc58e7e676b0fdadd215457ead67
但这与原生OpenSSL中该接口返回的格式不兼容。OpenSSL生成的是非压缩格式的公钥,即以0x04开头,长度为65个字节,如下所示,
0x04
04cccbcb22ad97a0749dd8d597108b862c48a58c290bf643d9c884d3e59096fa34d66847fa5f4790a767546e148fc769daf213e24ac57e58e9b8e033bce2932d05 04c7e35918cd835e2aba73bd2f7a76f3330420bcea577b64c4847125844a82495c236e054b80dc183d51672986ace8b1e153c3619cab3863d8d54caa69ccef293b
The text was updated successfully, but these errors were encountered:
我测试时用的是Tongsuo 8.4.0和OpenSSL 3.3.2。
Sorry, something went wrong.
奇怪的是,在macOS aarch64(M3)平台上测试时,没有遇到这个问题。 在该平台上,Tongsuo也是生成的非压缩格式的公钥。
No branches or pull requests
使用
EVP_PKEY_keygen
生成了SM2密钥对EVP_PKEY
,然后使用接口EVP_PKEY_get_octet_string_param
获取公钥,Tongsuo返回的公钥是压缩格式的,即以
0x02
或0x03
开头,长度仅为33个字节,如下所示,但这与原生OpenSSL中该接口返回的格式不兼容。OpenSSL生成的是非压缩格式的公钥,即以
0x04
开头,长度为65个字节,如下所示,The text was updated successfully, but these errors were encountered: