public void LoadXml_ValidXml(string xml, byte[] expectedModulus, byte[] expectedExponent)
        {
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(xml);

            RsaKeyValue rsa = new RsaKeyValue();

            rsa.LoadXml(xmlDocument.DocumentElement);

            Assert.Equal(expectedModulus, rsa.GetKey().Modulus.ToByteArrayUnsigned());
            Assert.Equal(expectedExponent, rsa.GetKey().Exponent.ToByteArrayUnsigned());
        }
        public void LoadXml_LoadXml_GetXml()
        {
            string      rsaKey = "<KeyValue xmlns=\"http://www.w3.org/2000/09/xmldsig#\"><RSAKeyValue><Modulus>ogZ1/O7iks9ncETqNxLDKoPvgrT4nFx1a3lOmpywEmgbc5+8vI5dSzReH4v0YrflY75rIJx13CYWMsaHfQ78GtXvaeshHlQ3lLTuSdYEJceKll/URlBoKQtOj5qYIVSFOIVGHv4Y/0lnLftOzIydem29KKH6lJQlJawBBssR12s=</Modulus><Exponent>AQAB</Exponent></RSAKeyValue></KeyValue>";
            XmlDocument doc    = new XmlDocument();

            doc.LoadXml(rsaKey);

            RsaKeyValue rsa1 = new RsaKeyValue();

            rsa1.LoadXml(doc.DocumentElement);

            string s = rsa1.GetXml().OuterXml;

            Assert.Equal(rsaKey, s);
        }
        public void LoadXml_InvalidXml(string xml)
        {
            XmlDocument xmlDocument = new XmlDocument();

            xmlDocument.LoadXml(xml);

            RsaKeyValue rsa = new RsaKeyValue();



            try
            {
                rsa.LoadXml(xmlDocument.DocumentElement);
            }
            catch (System.Security.Cryptography.CryptographicException) { }
            catch (FormatException) { }
        }
        public void LoadXml_Null()
        {
            RsaKeyValue rsa = new RsaKeyValue();

            Assert.Throws <ArgumentNullException>(() => rsa.LoadXml(null));
        }