I\'m receiving a SAML request via HTTP-redirect binding the content of the SAML request look like this
{\"SigAlg\"=>\"http://www.w3.org/2000/09/xmldsi
A SAML 2.0 signature is validated differently depending on the binding (POST or Redirect). If a POST binding is used the signature is validated in the SAML XML. If a Redirect binding is used the query string is validated with the signature.
This LogoutRequest is send with a redirect binding. The following C# sample code is copied from the ITfoxtec.Identity.Saml2 component and show how to validate the signature.
var queryString = request.QueryString;
var signatureValue = Convert.FromBase64String(request.Query["Signature"]);
var messageName = "SAMLRequest";
var signatureAlgorithm = "http://www.w3.org/2000/09/xmldsig#rsa-sha1";
var signatureValidationCertificate = new X509Certificate2("path-to-service-provider-x509-certificate");
var saml2Sign = new Saml2SignedText(signatureValidationCertificate, signatureAlgorithm);
if (saml2Sign.CheckSignature(Encoding.UTF8.GetBytes(new RawSaml2QueryString(queryString, messageName).SignedQueryString), signatureValue))
{
// Signature is valid.
}
else
{
throw new InvalidSignatureException("Signature is invalid.");
}