Skip to content
New issue

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

问题 关于公钥的 X, Y 如何生成 pem文件的字符串 #16

Closed
ZRothschild opened this issue Jun 9, 2021 · 3 comments
Closed

Comments

@ZRothschild
Copy link

ZRothschild commented Jun 9, 2021

我现在有这样的一个任务。就是用对方生成的sm2 公私钥。私钥是压缩格式,base64 .

第一个问题我使用 您的包 sign 函数签名,返回的签名信息与我调用支付宝的签名函数返回的签名信息不一致。不管用与不用 ASN.1 都不应不上。

如果我使用的时候压缩的公钥,你这边使用什么验签函数去,验签呢?当然我可以转换再验签

@ZZMarquis
Copy link
Owner

ZZMarquis commented Jun 10, 2021

1、SM2签名算法,就算每次使用的私钥和源数据都一样,签名结果也不相同,因为签名过程有随机数参与,所以不用比较两个签名函数返回的结果是否相同。而应该去验证两端之间是否能互相验签成功。
2、目前这个项目没有做压缩公钥的验签,你需要先把公钥转换成非压缩。

@ZRothschild
Copy link
Author

ZRothschild commented Jun 13, 2021 via email

@ZRothschild
Copy link
Author

ZRothschild commented Jun 14, 2021 via email

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants