// Create an RSAPKCS1KeyExchangeDeformatter object with a new RSA key. // Display its properties to the console. public void ConstructDeformatter() { // Construct an empty OAEP key exchange. RSAPKCS1KeyExchangeDeformatter rsaDeformatter = new RSAPKCS1KeyExchangeDeformatter(); // Create an RSAKey and set it into the specified // RSAPKCS1KeyExchangeFormatter. RSA key = RSA.Create(); rsaDeformatter.SetKey(key); RNGCryptoServiceProvider ring = new RNGCryptoServiceProvider(); rsaDeformatter.RNG = ring; Console.WriteLine(); Console.WriteLine("**" + rsaDeformatter.ToString() + "**"); string xmlParameters = rsaDeformatter.Parameters; Console.WriteLine(); Console.WriteLine("The RSA deformatter has the following "); Console.WriteLine("parameters:" + xmlParameters); }
public void Properties() { RSAPKCS1KeyExchangeDeformatter keyex = new RSAPKCS1KeyExchangeDeformatter(); keyex.SetKey(key); Assert.IsNull(keyex.Parameters, "RSAPKCS1KeyExchangeDeformatter.Parameters"); // null (default) Assert.IsNull(keyex.RNG, "RSAPKCS1KeyExchangeDeformatter.RNG"); Assert.AreEqual("System.Security.Cryptography.RSAPKCS1KeyExchangeDeformatter", keyex.ToString()); }