从非对称算法获取私钥

时间:2015-03-12 01:57:54

标签: c# encryption

如何从AsymmetricAlgorithm.ToXmlString()获取私钥?

XML字符串只有一堆节点。我不确定它们的含义:

<RSAKeyValue>
  <Modulus>
    kepPAzfA0xSF...
  </Modulus>
  <Exponent>
    AQAB
  </Exponent>
  <P>
    vSUa7Lw...
  </P>
  <Q>
    xX2KSkvg...
  </Q>
  <DP>
    XQD+wUM...
  </DP>
  <DQ>
    fxHfwR5B...
  </DQ>
  <InverseQ>
    Zpmx1El6...
  </InverseQ>
  <D>
    BOgHtMhTeoWDzn...
  </D>
</RSAKeyValue>

编辑: C#代码:

    string pfxFilePath = @"C:\temp\someCert.pfx";
    string pfxPassword = "somePassword";
    X509Certificate2 cert = new X509Certificate2(pfxFilePath, pfxPassword, X509KeyStorageFlags.Exportable);

    string privateKey = cert.PrivateKey.ToXmlString(true);//This has the xml code above

0 个答案:

没有答案