Given a private key, is it possible to derive its public key?(给定一个私钥,是否可以导出它的公钥?)
问题描述
根据我通过阅读各种材料所了解的一点点,公私钥对是非对称加密的基础,也是选择 2 个素数(大致是您的私钥)并将它们相乘(大致是您的公钥)的基础).在我看来,如果您知道私钥,则可以生成公钥.是正确的还是我弄错了什么?
From whatever little I understand by reading various material, public-private key pair are the basis of asymmetric encryption and also something about choosing 2 prime numbers (which is roughly your private key) and multiplying them (which is roughly your public key). It appears to me that it is possible to generate a public key if you know the private key. Is it correct or I am mistaking something?
让我更困惑的是,无法使用 only 私钥(使用 .NET 类 RSACryptoServiceProvider)将 RSA 密钥序列化为 XML.不知道这个限制是不是故意的!
What made me more confusing was that it is not possible to serialize the RSA key to XML with only private key (using .NET class RSACryptoServiceProvider). Not sure whether this limitation is intentional or not!
推荐答案
这取决于加密系统.
在 RSA 中,我们有(引用维基百科):
In RSA, we have (citing Wikipedia):
公钥由模数 n 和公开(或加密)指数 e 组成.这私钥由模数 n 和私钥(或解密)指数 d 组成,其中必须保密.
The public key consists of the modulus n and the public (or encryption) exponent e. The private key consists of the modulus n and the private (or decryption) exponent d which must be kept secret.
现在,如果我们有 n 和 d(私钥),我们只缺少 e 作为公钥.但 e 通常相当小(小于三位数),甚至是固定的(常见值为 65537).在这些情况下,获取公钥是微不足道的.
Now if we have n and d (the private key), we are only missing e for the public key. But e is often fairly small (less than three digits), or even fixed (a common value is 65537). In these cases getting the public key is trivial.
对于Elliptic Curve Diffie-Hellman,私钥是d,公钥是dG(G也是公开的),所以也很简单.
For Elliptic Curve Diffie-Hellman, the private key is d, and the public key dG (with G also public), so it's trivial as well.
这篇关于给定一个私钥,是否可以导出它的公钥?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:给定一个私钥,是否可以导出它的公钥?


- C# 中多线程网络服务器的模式 2022-01-01
- 良好实践:如何重用 .csproj 和 .sln 文件来为 CI 创建 2022-01-01
- MoreLinq maxBy vs LINQ max + where 2022-01-01
- Web Api 中的 Swagger .netcore 3.1,使用 swagger UI 设置日期时间格式 2022-01-01
- WebMatrix WebSecurity PasswordSalt 2022-01-01
- C#MongoDB使用Builders查找派生对象 2022-09-04
- 带有服务/守护程序应用程序的 Microsoft Graph CSharp SDK 和 OneDrive for Business - 配额方面返回 null 2022-01-01
- 输入按键事件处理程序 2022-01-01
- 在哪里可以找到使用中的C#/XML文档注释的好例子? 2022-01-01
- 如何用自己压缩一个 IEnumerable 2022-01-01