Verify signature on SAML assertion

This example code verifies SAML response using UltimateSAML. It helps verify nested SAML assertion signature inside a response.

XmlDocument xmlDocument = new XmlDocument();
XmlDocument xmlDocumentMetadata = new XmlDocument();
// Load the SAML response from the XML document.
Response samlResponse = new Response(xmlDocument.DocumentElement);
// Is it signed?
if (samlResponse.IsSigned())
    // Validate the SAML response with the certificate.
    if (!samlResponse.Validate(xmlDocumentMetadata.DocumentElement))
        throw new ApplicationException("SAML response signature is not valid.");

Check the following link for a more detailed online example.

45-Day Money Back Guarantee

We will refund your full money in 45 days
if you are not satisfied with our products

Buy Now