【发布时间】:2011-08-31 20:35:29
【问题描述】:
我正在开发一个实现 PGP 加密的应用程序。我面临一个问题,我们需要从 PGP 公钥中提取模数和指数。我正在使用Bouncy castle PGP 库。请帮忙。
【问题讨论】:
标签: c# .net bouncycastle pgp openpgp
我正在开发一个实现 PGP 加密的应用程序。我面临一个问题,我们需要从 PGP 公钥中提取模数和指数。我正在使用Bouncy castle PGP 库。请帮忙。
【问题讨论】:
标签: c# .net bouncycastle pgp openpgp
选择公钥后试一下密码
PgpPublicKey PublicKey;
var val = (RsaKeyParameters)PublicKey.GetKey();
string ModulusVal = Convert.ToBase64String(Encoding.UTF8.GetBytes(val.Modulus.ToString()));
string ExponentVal = Convert.ToBase64String(Encoding.UTF8.GetBytes(val.Exponent.ToString()));
XDocument X = new XDocument(new XDeclaration("1.0", "UTF-8", "yes"),
new XElement("RSAKeyValue",
new XElement("Modulus", ModulusVal),
new XElement("Exponent", ExponentVal)));
X.Save(XMLFileSavePath, SaveOptions.None);
【讨论】: