public void GetXml_SameRsa()
        {
            var keyGen = GeneratorUtilities.GetKeyPairGenerator("RSA");

            keyGen.Init(new KeyGenerationParameters(new SecureRandom(), 1024));
            var         pair         = keyGen.GenerateKeyPair();
            RsaKeyValue rsaKeyValue1 = new RsaKeyValue((RsaKeyParameters)pair.Public);
            RsaKeyValue rsaKeyValue2 = new RsaKeyValue((RsaKeyParameters)pair.Public);

            Assert.Equal(rsaKeyValue1.GetXml(), rsaKeyValue2.GetXml());
        }
        public void GetXml()
        {
            RsaKeyValue rsa    = new RsaKeyValue();
            XmlElement  xmlkey = rsa.GetXml();


            const string schema = "http://www.w3.org/2000/09/xmldsig#";

            new[] { "Exponent", "Modulus" }
            .Select(elementName => Convert.FromBase64String(xmlkey.SelectSingleNode($"*[local-name()='RSAKeyValue' and namespace-uri()='{schema}']/*[local-name()='{elementName}' and namespace-uri()='{schema}']").InnerText))
            .ToArray();
        }
        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);
        }