生成公钥-私钥对并将其显示在 asp.net 的文本框中
任何机构都可以解释 RSAParameters 的参数 我见过像 p,d,e,q,... 这样的参数 我需要其中的私钥和公钥,
我得到了链接
http://msdn.microsoft.com/en-us/library/system.security.cryptography.rsaparameters%28v=vs.90%29.aspx[^]
我正在使用示例代码,如下所示 谁能说这是对还是错 示例代码:
//Generate a public/private key pair.
RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();
//Save the public key information to an RSAParameters structure.
RSAParameters RSAKeyInfo = RSA.ExportParameters(true);
//public key
TextBox5.Text = Convert.ToBase64String(RSAKeyInfo.Exponent);
// private key
TextBox6.Text = Convert.ToBase64String(RSAKeyInfo.D);
他们已经给出了 公钥是 {e,n},其中 n = (P*Q) 的结果 私钥是 {d, n},其中 n =
我所做的 (P*Q) 的结果在公钥和私钥的示例代码中是否正确,
非常感谢
any body can explain the parameters of RSAParameters
i had seen the parameters like p,d,e,q,...
i need the private key and public key from it
i got the link
http://msdn.microsoft.com/en-us/library/system.security.cryptography.rsaparameters%28v=vs.90%29.aspx[^]
i am using the sample code as like this
can anybody can say it was right or not
sample code:
//Generate a public/private key pair.
RSACryptoServiceProvider RSA = new RSACryptoServiceProvider();
//Save the public key information to an RSAParameters structure.
RSAParameters RSAKeyInfo = RSA.ExportParameters(true);
//public key
TextBox5.Text = Convert.ToBase64String(RSAKeyInfo.Exponent);
// private key
TextBox6.Text = Convert.ToBase64String(RSAKeyInfo.D);
they had give as that the
public key is {e,n} where n = result of the (P*Q)
Private key is {d, n} where n = result of the (P*Q)
where i had done is the correct thing or not in the sample code for the public and private keys
thanks alot
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
使用 BouncyCastle API
http://www.bouncycastle.org/
以及类似以下内容:
您可以访问具有 .
Public
和 .Private
属性以及格式正确的字符串的对象。不久前我遇到了类似的问题,这是我能找到的最佳解决方案。我手头没有确切的代码,但如果需要,我会在进入办公室时发布它,但上述应该可行。
使用代码更新
这是我用来生成公钥/私钥的代码。
Using the BouncyCastle API
http://www.bouncycastle.org/
and something similiar to the following:
You can access an object that will have a .
Public
and .Private
property with the correctly formatted strings.I had a similiar problem a while back and this was the best solution that I could find. I do not have the exact code to hand, but will post it when I get into the office if required, but the above should work.
Updated with Code
This is the code I used to generate public/private keys.