/// <summary> /// Verify the signature of an XML string that contains key info against an asymmetric algorithm and return the result. /// </summary> /// <param name="xmlData">XML document as a string which holds the signed XML data with key info tag.</param> /// <returns>The status of the verification.</returns> /// <exception cref="XmlException">There is a load or parse error in the XML.</exception> /// <exception cref="CryptographicException">No signature found or more than one signature found. /// -OR- The value parameter does not contain a valid signature or signature info. /// -OR- The signature algorithm of the key parameter does not match the signature method. /// -OR- The signature description could not be created. /// -OR- The hash algorithm could not be created.</exception> public static bool VerifyXml(string xmlData) { return(XMLSigning.VerifyXml(xmlData)); }
/// <summary> /// Verify the signature of an XML string against an asymmetric algorithm and return the result. /// </summary> /// <param name="xmlData">XML string which holds the signed XML data.</param> /// <param name="signingKey">RSA public key that is associated with the key that was used in signing the XML.</param> /// <returns>The status of the verification.</returns> /// <exception cref="NotSupportedException">The key algorithm is not supported.</exception> /// <exception cref="XmlException">There is a load or parse error in the XML.</exception> /// <exception cref="ArgumentNullException">Any of the passed arguments is null.</exception> /// <exception cref="CryptographicException">The key value is not an RSA key, or the key is unreadable. /// -OR- No signature found or more than one signature found. /// -OR- The value parameter does not contain a valid signature or signature info. /// -OR- The signature algorithm of the key parameter does not match the signature method. /// -OR- The signature description could not be created. /// -OR- The hash algorithm could not be created.</exception> public static bool VerifyXml(string xmlData, X509Certificate2 signingKey) { return(XMLSigning.VerifyXml(xmlData, signingKey)); }