public static bool VerifyXML(string strXML) { bool bResult = false; try { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.PreserveWhitespace = true; xmlDocument.LoadXml(strXML); MySignedXml signedXml = new MySignedXml(xmlDocument); XmlNodeList nodeList = xmlDocument.GetElementsByTagName("Signature"); signedXml.LoadXml((XmlElement)nodeList[0]); AsymmetricAlgorithm key = null; if (signedXml.CheckSignatureReturningKey(out key)) { bResult = true; } } catch (Exception exc) { MessageBox.Show(exc.ToString(), Messages.ExceptionTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop); } return(bResult); }
public static bool VerifyXML(string strXML) { bool bResult = false; try { XmlDocument xmlDocument = new XmlDocument(); xmlDocument.PreserveWhitespace = true; xmlDocument.LoadXml(strXML); MySignedXml signedXml = new MySignedXml(xmlDocument); XmlNodeList nodeList = xmlDocument.GetElementsByTagName("Signature"); signedXml.LoadXml((XmlElement)nodeList[0]); AsymmetricAlgorithm key = null; if (signedXml.CheckSignatureReturningKey(out key)) { bResult = true; } } catch (Exception exc) { MessageBox.Show(exc.ToString(), Messages.ExceptionTitle, MessageBoxButtons.OK, MessageBoxIcon.Stop); } return bResult; }