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); }
public static void Verify(string licenseText) { if (string.IsNullOrEmpty(licenseText)) { throw new Exception("Empty license string"); } var xmlVerifier = new SignedXmlVerifier(PublicKey); xmlVerifier.VerifyXml(licenseText); }
public void Valid_xml_does_not_throw() { var validXml = ResourceReader.ReadResourceAsString("Licensing.SignedValid.xml"); SignedXmlVerifier.VerifyXml(SignedXmlVerifier.PublicKey, validXml); }
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); }