Esempio n. 1
0
        public void Can_parse_public_key_xml_with_different_whitespace()
        {
            var pk1 = PlatformRsaUtils.ExtractFromXml(PublicKeyXml);
            var pk2 = PlatformRsaUtils.ExtractFromXml(PublicKeyXmlWithSpaces);

            Assert.That(pk1.Modulus, Is.EqualTo(pk2.Modulus));
            Assert.That(pk1.Exponent, Is.EqualTo(pk2.Exponent));
        }
Esempio n. 2
0
        public void Can_parse_public_key_xml()
        {
            var pk1 = PlatformRsaUtils.ExtractFromXml(PublicKeyXml);

            using (var rsa = RSA.Create())
            {
                rsa.FromXml(PublicKeyXml);

                var pk2 = rsa.ExportParameters(includePrivateParameters: false);

                Assert.That(pk1.Modulus, Is.EqualTo(pk2.Modulus));
                Assert.That(pk1.Exponent, Is.EqualTo(pk2.Exponent));
                Assert.That(pk1.P, Is.EqualTo(pk2.P));
                Assert.That(pk1.Q, Is.EqualTo(pk2.Q));
                Assert.That(pk1.DP, Is.EqualTo(pk2.DP));
                Assert.That(pk1.DQ, Is.EqualTo(pk2.DQ));
                Assert.That(pk1.InverseQ, Is.EqualTo(pk2.InverseQ));
                Assert.That(pk1.D, Is.EqualTo(pk2.D));
            }
        }