【发布时间】:2011-09-25 17:46:23
【问题描述】:
任何机构都可以解释 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) 的结果
在公钥和私钥的示例代码中,我所做的是否正确
非常感谢
【问题讨论】:
-
请记住,并非所有字节数组都可以显示为有效字符串,并且它们不必在从 byte[] 到 string 到 byte[] 的往返过程中幸存下来
-
Exponent属性应该返回像“AQAB”这样的指数,而不是公钥......在您的情况下尝试Modulus属性会更有意义
标签: c# asp.net rsacryptoserviceprovider