# Signature is invalid error on SAML integration

**URL:** <https://devforum.okta.com/t/signature-is-invalid-error-on-saml-integration/11931>\
**Category:** SAML\
**Created:** [November 30, 2020, 2:29pm UTC](https://devforum.okta.com/t/signature-is-invalid-error-on-saml-integration/11931 "2020-11-30T14:29:15Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![vikas](https://avatars.discourse-cdn.com/v4/letter/v/ac91a4/32.png) [@vikas](https://devforum.okta.com/u/vikas)\
**Post date:** [November 30, 2020, 2:29pm UTC](https://devforum.okta.com/t/signature-is-invalid-error-on-saml-integration/11931/1 "2020-11-30T14:29:15Z")

</div>

Hi,

I am getting “Signature is invalid” error on SAML integration with okta idp. I have created my own SP .net core 2.1 application using ITfoxtec SAML 2.0 open source tool.  
I have followed all the steps given in link below but getting “Signature is invalid” on following highlighted line (binding.Unbind(Request.ToGenericHttpRequest(), saml2AuthnResponse);).

Reference link: [https://developer.okta.com/blog/2020/10/23/how-to-authenticate-with-saml-in-aspnet-core-and-csharp](https://developer.okta.com/blog/2020/10/23/how-to-authenticate-with-saml-in-aspnet-core-and-csharp)

```
  [HttpPost]
    public async Task<IActionResult> AssertionConsumerService()
    {
        var binding = new Saml2PostBinding();
        var saml2AuthnResponse = new Saml2AuthnResponse(config);
        
        binding.ReadSamlResponse(Request.ToGenericHttpRequest(), saml2AuthnResponse);
        if (saml2AuthnResponse.Status != Saml2StatusCodes.Success)
        {
            throw new AuthenticationException($"SAML Response status: {saml2AuthnResponse.Status}");
        }

        **binding.Unbind(Request.ToGenericHttpRequest(), saml2AuthnResponse);**
        await saml2AuthnResponse.CreateSession(HttpContext,claimsTransform: (claimsPrincipal) => ClaimsTransform.Transform(claimsPrincipal));

        var returnUrl = binding.GetRelayStateQuery()[relayStateReturnUrl];
        return Redirect(string.IsNullOrWhiteSpace(returnUrl) ? Url.Content("~/") : returnUrl);
    }

```

Any help will be appreciated.

---

<div class="post-metadata">

**Author:** ![Fuzzard](https://sea1.discourse-cdn.com/oktadev/user_avatar/devforum.okta.com/fuzzard/32/1909_2.png) [@Fuzzard](https://devforum.okta.com/u/Fuzzard)\
**Post date:** [December 1, 2020, 10:26pm UTC](https://devforum.okta.com/t/signature-is-invalid-error-on-saml-integration/11931/2 "2020-12-01T22:26:11Z")

</div>

Hi, is the SAML response received successfully from Okta at this point?  
is the same issue encountered if you create a new okta app and update the metadata in your appsettings.json file?

---

<div class="post-metadata">

**Author:** ![vikas](https://avatars.discourse-cdn.com/v4/letter/v/ac91a4/32.png) [@vikas](https://devforum.okta.com/u/vikas)\
**Post date:** [December 2, 2020, 6:03am UTC](https://devforum.okta.com/t/signature-is-invalid-error-on-saml-integration/11931/3 "2020-12-02T06:03:32Z")

</div>

Hi,

The issue is resolved now.  
The problem was with wrong SignatureAlgorithm used in appsettings, after changing to below signature algorithm the issue is resolved.  
“[http://www.w3.org/2000/09/xmldsig#rsa-sha1](http://www.w3.org/2000/09/xmldsig#rsa-sha1)”

Thanks.

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/oktadev/original/1X/589c4c5f80de422d01f47cee7185a7fb8227835c.png) [@system](https://devforum.okta.com/u/system)\
**Post date:** [December 3, 2020, 6:03am UTC](https://devforum.okta.com/t/signature-is-invalid-error-on-saml-integration/11931/4 "2020-12-03T06:03:33Z")

</div>

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.
