Пример #1
0
        public void Invalid_xml_is_not_verified()
        {
            var invalidXml = ResourceReader.ReadResourceAsString("Licensing.SignedInvalid.xml");
            var exception  = Assert.Throws <Exception>(() => SignedXmlVerifier.VerifyXml(SignedXmlVerifier.PublicKey, invalidXml));

            Assert.AreEqual("License is invalid as it failed signature check.", exception.Message);
        }
        public static void Verify(string licenseText)
        {
            if (string.IsNullOrEmpty(licenseText))
            {
                throw new Exception("Empty license string");
            }

            SignedXmlVerifier.VerifyXml(licenseText);
        }
Пример #3
0
        public static void Verify(string licenseText)
        {
            if (string.IsNullOrEmpty(licenseText))
            {
                throw new Exception("Empty license string");
            }

            var xmlVerifier = new SignedXmlVerifier(PublicKey);

            xmlVerifier.VerifyXml(licenseText);
        }
Пример #4
0
        public void Valid_xml_does_not_throw()
        {
            var validXml = ResourceReader.ReadResourceAsString("Licensing.SignedValid.xml");

            SignedXmlVerifier.VerifyXml(SignedXmlVerifier.PublicKey, validXml);
        }
Пример #5
0
        public void Non_xml_should_throw()
        {
            var exception = Assert.Throws <Exception>(() => SignedXmlVerifier.VerifyXml(SignedXmlVerifier.PublicKey, "sdfsdf"));

            Assert.AreEqual("The text provided could not be parsed as XML.", exception.Message);
        }