2017-04-24 109 views
0

我的代码:试图输出RSA私钥

using System.Security.Cryptography; 

public class Test 
{ 
    public static void Main() 
    { 
     RSACryptoServiceProvider RSA = new RSACryptoServiceProvider(); 

     System.Console.WriteLine(RSA.ToXMLString(false)); 
    } 
} 

当我运行它,我得到以下几点:

test.cs(10,38): error CS1061: 'RSACryptoServiceProvider' does not contain a definition for 'ToXMLString' and no extension method 'ToXMLString' accepting a first argument of type 'RSACryptoServiceProvider' could be found (are you missing a using directive or an assembly reference?) 

什么我还挺期待更多的东西是这样的:

<?xml version="1.0" encoding="utf-16"?> 

<RSAParameters xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> 
     <Exponent>AQAB</Exponent> 
     <Modulus>sMFsHSyxAP5N85yvx/XDs9acJa30qwBjoOdDKvNOHJUYBpspwatkdtErCqM2W6tXH9rbvhIn8/nqW4OqAdLinlgkEJoQ/qnzKjYJhHl4YzKFL6Wp+iFRH6ar6ZWOE87LeNQ0nHwlXKoWkJQKV8NB38XRw6aLvNTj8Po2yaFDbQFztsJ+ILkumRh7Leu77IV+124Swc6JqLRt5z2FnDX869dRi2fqcnFa1EHEBsPEndVd2HSeJUncTQiWJ9SNRU+WLltVVewYiGheqr1ABab++3XM5qrB6fWn/RN9Fcg5nM8fachAFSX2YRrEsg7mcbNALRes6OEdpI0LBdX8Wdw6oQ==</Modulus> 
    </RSAParameters> 

任何想法?

+0

@ScottChamberlain - 看起来像4.6.2。 – neubert

+3

你有一个简单的容错性错误,它是'ToXmlString(false)'not'.ToXMLString(false)' –

回答