// Create an RSAOAEPKeyExchangeDeformatter object with a new RSA key. // Display its properties to the console. private void ConstructDeformatter() { // Construct an empty OAEP key exchange. //<Snippet10> RSAOAEPKeyExchangeDeformatter rsaDeformatter = new RSAOAEPKeyExchangeDeformatter(); //</Snippet10> // Create an RSAKey and set it into the specified // RSAOAEPKeyExchangeFormatter. //<Snippet11> RSA key = RSA.Create(); rsaDeformatter.SetKey(key); //</Snippet11> Console.WriteLine(); Console.WriteLine("**" + rsaDeformatter.ToString() + "**"); //<Snippet12> string xmlParameters = rsaDeformatter.Parameters; //</Snippet12> Console.WriteLine(); Console.WriteLine("The RSA deformatter has the following "); Console.WriteLine("parameters:" + xmlParameters); }
public void Properties() { RSAOAEPKeyExchangeDeformatter keyex = new RSAOAEPKeyExchangeDeformatter(); keyex.SetKey(key); Assertion.AssertNull("RSAOAEPKeyExchangeDeformatter.Parameters", keyex.Parameters); Assertion.AssertEquals("RSAOAEPKeyExchangeDeformatter.ToString()", "System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter", keyex.ToString()); }
public void Properties() { RSAOAEPKeyExchangeDeformatter keyex = new RSAOAEPKeyExchangeDeformatter(); keyex.SetKey(key); Assert.IsNull(keyex.Parameters, "RSAOAEPKeyExchangeDeformatter.Parameters"); Assert.AreEqual("System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter", keyex.ToString()); }
public byte[] DecryptSessionKeyByRSA(byte[] exchangeData) { AsymmetricAlgorithm rsa = algo; RSAOAEPKeyExchangeDeformatter defor = new RSAOAEPKeyExchangeDeformatter(); defor.SetKey(rsa); byte[] keySession = defor.DecryptKeyExchange(exchangeData); return(keySession); }