在Go语言中,有没有一种将ECDSA密钥转换为RSA密钥,反之亦然的方法?

huangapple go评论73阅读模式
英文:

Is there any way of converting ECDSA key to RSA key, and vice-versa as well in Go language?

问题

我正在同时研究加密方法,并希望将ECDSA密钥转换为RSA密钥,反之亦然。

英文:

I am working on both encryption methods and want to convert the ECDSA key to RSA key and vice versa.

答案1

得分: 1

不,没有办法进行转换。ECDSA和RSA是完全不同的算法,无法相互转换。ECDSA是基于椭圆曲线离散对数问题的算法,而RSA是基于因子分解问题的有限域算法。此外,RSA可以用于签名和加密,而ECDSA只能用于签名。

如果你希望你的代码同时处理两种算法,你需要有两个独立的代码路径,一个用于ECDSA,一个用于RSA。

英文:

No, there isn't. ECDSA and RSA are completely different and can't be converted. ECDSA is an elliptic-curve algorithm based on the elliptic-curve discrete logarithm problem, and RSA is a finite-field algorithm based on the factoring problem. In addition, RSA can be used for signing and encryption, and ECDSA can only sign.

If you want your code to handle both, you'll need to have two separate code paths, one for ECDSA and one for RSA.

huangapple
  • 本文由 发表于 2022年8月4日 18:14:22
  • 转载请务必保留本文链接:https://go.coder-hub.com/73234112.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定