# ASP.NET,C# Error - DX10500: Signature validation failed. Unable to resolve SecurityKeyIdentifier

**URL:** <https://forum.keycloak.org/t/asp-net-c-error-dx10500-signature-validation-failed-unable-to-resolve-securitykeyidentifier/6567>\
**Category:** Getting advice\
**Created:** [December 28, 2020, 5:45pm UTC](https://forum.keycloak.org/t/asp-net-c-error-dx10500-signature-validation-failed-unable-to-resolve-securitykeyidentifier/6567 "2020-12-28T17:45:32Z")\
**Posts on this page:** 12\
**Page:** 1

<div class="post-metadata">

**Author:** ![tma](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/tma/32/1980_2.png) [@tma](https://forum.keycloak.org/u/tma)\
**Post date:** [December 28, 2020, 5:45pm UTC](https://forum.keycloak.org/t/asp-net-c-error-dx10500-signature-validation-failed-unable-to-resolve-securitykeyidentifier/6567/1 "2020-12-28T17:45:32Z")

</div>

I am having trouble authentication an [asp.net](http://asp.net) MVC app (Framework 4.8).  
The token is returned but somehow not authenticated - this is the full errormessage

DX10500: Signature validation failed. Unable to resolve SecurityKeyIdentifier: 'SecurityKeyIdentifier  
(  
IsReadOnly = False,  
Count = 1,  
Clause[0] = System.IdentityModel.Tokens.NamedKeySecurityKeyIdentifierClause  
)  
',  
token: ‘{“alg”:“HS512”,“typ”:“JWT”,“kid”:“ba913656-689d-457d-a466-d56119311451”}.{“exp”:1609177556,“iat”:1609177256,“auth\_time”:1609176273,“jti”:“1840f400-2cf4-4167-a451-59887f0c959b”,“iss”:“[https://auth.justbytes.io/auth/realms/test",“aud”:“account”,“sub”:“343b94bb-f994-4561-ad3b-9b9eff7e3513”,“typ”:“Bearer”,“azp”:“testapp”,“session\_state”:“d3b486f8-da68-4c56-9680-71b8c44a0d14”,“acr”:“0”,“allowed-origins”:["\*"],“realm\_access”:{“roles”:[“TestAppAccess”,“offline\_access”,“sg\_SamlApp”,“uma\_authorization”]},“resource\_access”:{“account”:{“roles”:[“manage-account”,“manage-account-links”,“view-profile”]}},“scope”:"openid](https://auth.justbytes.io/auth/realms/test%22,%22aud%22:%22account%22,%22sub%22:%22343b94bb-f994-4561-ad3b-9b9eff7e3513%22,%22typ%22:%22Bearer%22,%22azp%22:%22testapp%22,%22session_state%22:%22d3b486f8-da68-4c56-9680-71b8c44a0d14%22,%22acr%22:%220%22,%22allowed-origins%22:%5B%22*%22%5D,%22realm_access%22:%7B%22roles%22:%5B%22TestAppAccess%22,%22offline_access%22,%22sg_SamlApp%22,%22uma_authorization%22%5D%7D,%22resource_access%22:%7B%22account%22:%7B%22roles%22:%5B%22manage-account%22,%22manage-account-links%22,%22view-profile%22%5D%7D%7D,%22scope%22:%22openid) profile email”,“email\_verified”:false,“name”:“Thomas Hansen”,“preferred\_username”:“gnu”,“given\_name”:“Thomas”,“family\_name”:“Hansen”,“email”:“gnu@tbma.dk”}’.

Any help?

Kind regards  
Thomas.

---

<div class="post-metadata">

**Author:** ![jangaraj](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/jangaraj/32/5175_2.png) [@jangaraj](https://forum.keycloak.org/u/jangaraj)\
**Post date:** [December 28, 2020, 6:37pm UTC](https://forum.keycloak.org/t/asp-net-c-error-dx10500-signature-validation-failed-unable-to-resolve-securitykeyidentifier/6567/2 "2020-12-28T18:37:24Z")

</div>

Are you sure that `HS512` signing algorithm (used in your token) is supported by your app/code?

I would go with more common `RS256` algorithm in your case. You can configure that one in the Realm settings -\> Tokens -\> `Default Signature Algorithm`.

---

<div class="post-metadata">

**Author:** ![tma](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/tma/32/1980_2.png) [@tma](https://forum.keycloak.org/u/tma)\
**Post date:** [December 28, 2020, 8:06pm UTC](https://forum.keycloak.org/t/asp-net-c-error-dx10500-signature-validation-failed-unable-to-resolve-securitykeyidentifier/6567/3 "2020-12-28T20:06:06Z")

</div>

> [@jangaraj](#):
>
> RS25

Hello Jangaraj,  
This is strange - it keeps outputting the HS256 no matter what i set in the “Default signature Algorithm”  
I tried to create a new Realm and app - same response.

IDX10500: Signature validation failed. Unable to resolve SecurityKeyIdentifier: 'SecurityKeyIdentifier  
(  
IsReadOnly = False,  
Count = 1,  
Clause[0] = System.IdentityModel.Tokens.NamedKeySecurityKeyIdentifierClause  
)  
',  
token: ‘{“alg”:“HS256”,“typ”:“JWT”,“kid”:“c99f0ae1-99e5-4fca-8e4b-8272027a6248”}.{“exp”:1609187549,“iat”:1609185749,“jti”:“717b2355-f1b8-4b7d-9eb8-8c24b84ba9ab”,“iss”:“[https://auth.justbytes.io/auth/realms/test2",“aud”:“https://auth.justbytes.io/auth/realms/test2”,“sub”:“ce8e8b4d-1edc-4aab-b0c1-5b6ab0b2b674”,“typ”:“Refresh”,“azp”:“apptest”,“session\_state”:“8e2ba602-899e-409e-90f4-d83d34806cc4”,“scope”:"openid](https://auth.justbytes.io/auth/realms/test2%22,%22aud%22:%22https://auth.justbytes.io/auth/realms/test2%22,%22sub%22:%22ce8e8b4d-1edc-4aab-b0c1-5b6ab0b2b674%22,%22typ%22:%22Refresh%22,%22azp%22:%22apptest%22,%22session_state%22:%228e2ba602-899e-409e-90f4-d83d34806cc4%22,%22scope%22:%22openid) email profile”}’.

I am using version 12.0.1 in Docker

---

<div class="post-metadata">

**Author:** ![jangaraj](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/jangaraj/32/5175_2.png) [@jangaraj](https://forum.keycloak.org/u/jangaraj)\
**Post date:** [December 28, 2020, 9:03pm UTC](https://forum.keycloak.org/t/asp-net-c-error-dx10500-signature-validation-failed-unable-to-resolve-securitykeyidentifier/6567/4 "2020-12-28T21:03:25Z")

</div>

I guess your are configuring that for master realm, but your app is using test realm. Make sure you are configuring right realm.

---

<div class="post-metadata">

**Author:** ![tma](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/tma/32/1980_2.png) [@tma](https://forum.keycloak.org/u/tma)\
**Post date:** [December 28, 2020, 9:05pm UTC](https://forum.keycloak.org/t/asp-net-c-error-dx10500-signature-validation-failed-unable-to-resolve-securitykeyidentifier/6567/5 "2020-12-28T21:05:16Z")

</div>

Sorry - but it looks right…  
 ![image](https://global.discourse-cdn.com/free1/uploads/keycloak/original/2X/2/265c657f1ad3e10b451691539ce300ee1530ca8e.png)

---

<div class="post-metadata">

**Author:** ![tma](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/tma/32/1980_2.png) [@tma](https://forum.keycloak.org/u/tma)\
**Post date:** [December 28, 2020, 9:36pm UTC](https://forum.keycloak.org/t/asp-net-c-error-dx10500-signature-validation-failed-unable-to-resolve-securitykeyidentifier/6567/6 "2020-12-28T21:36:18Z")

</div>

> [@tma](#):
>
> IDX10500

I found this

 ![image](https://global.discourse-cdn.com/free1/uploads/keycloak/original/2X/4/4b1cd2853f53e468c247e1be00925bcc63741a11.png)

> <https://github.com/dylanplecki/KeycloakOwinAuthentication/issues/54>
>
> Hi,
> 
> Thank you for creating this library. I just cloned the sample ASP.Net 5 p…roject and tried to ran the app with my own keycloak server settings. For the first time I received an exception related to the "audience" validation, since I dont need that I just disabled that using the property "DisableAudienceValidation". Now I am getting another exception related to SecurityKeyIdentifier.
> 
> Could you please let me know what is missing?
> 
> The exception is as below.
> 
> IDX10500: Signature validation failed. Unable to resolve SecurityKeyIdentifier: 'SecurityKeyIdentifier
> (
> IsReadOnly = False,
> Count = 1,
> Clause\[0\] = System.IdentityModel.Tokens.NamedKeySecurityKeyIdentifierClause
> )
> ',
> token: '{"alg":"HS256","typ":"JWT","kid":"4718be89-a61c-4007-b355-6c85319c9c9f"}.{"jti":"8635361e-7825-40d9-94a4-faae4b3fe264","exp":1565278106,"nbf":0,"iat":1565276306,"iss":"http://localhost:8080/auth/realms/master","aud":"http://localhost:8080/auth/realms/master","sub":"dd09c01c-be26-48b6-9942-efc0b1abc3b6","typ":"Refresh","azp":"sampleclient","auth\_time":0,"session\_state":"a59830f0-9fd2-4bf4-ae74-7dda461aab0f","realm\_access":{"roles":\["offline\_access","uma\_authorization"\]},"resource\_access":{"account":{"roles":\["manage-account","manage-account-links","view-profile"\]}},"scope":"openid email profile"}'.

That’s pretty bad if that is the case.

---

<div class="post-metadata">

**Author:** ![jangaraj](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/jangaraj/32/5175_2.png) [@jangaraj](https://forum.keycloak.org/u/jangaraj)\
**Post date:** [December 28, 2020, 10:21pm UTC](https://forum.keycloak.org/t/asp-net-c-error-dx10500-signature-validation-failed-unable-to-resolve-securitykeyidentifier/6567/7 "2020-12-28T22:21:42Z")

</div>

I would say no problem. Just select another OIDC certified library for your use case - [https://openid.net/developers/certified/](https://openid.net/developers/certified/) . It really doesn’t need to have have “keycloak” in the name, because OIDC is not a Keycloak specific protocol.

---

<div class="post-metadata">

**Author:** ![tma](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/tma/32/1980_2.png) [@tma](https://forum.keycloak.org/u/tma)\
**Post date:** [December 29, 2020, 2:29pm UTC](https://forum.keycloak.org/t/asp-net-c-error-dx10500-signature-validation-failed-unable-to-resolve-securitykeyidentifier/6567/8 "2020-12-29T14:29:46Z")

</div>

We have a success - thanks you for your help in pointing me in the right direction Jangaraj 🙂 ![image](https://global.discourse-cdn.com/free1/uploads/keycloak/original/2X/7/7e929ae3c885fa9e1f191be3ce7055ad8f48b675.png)

---

<div class="post-metadata">

**Author:** ![codeninja2021](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@codeninja2021](https://forum.keycloak.org/u/codeninja2021)\
**Post date:** [February 22, 2022, 8:35am UTC](https://forum.keycloak.org/t/asp-net-c-error-dx10500-signature-validation-failed-unable-to-resolve-securitykeyidentifier/6567/9 "2022-02-22T08:35:02Z")

</div>

Hi tma,  
I used the same library and facing the same issue that you were facing. I am very new to keycloak.  
Now I have opted for “IdentityModel.OidcClient”.

It shall be great if you can share the startup.cs configuration code snippet for the same.

I am facing the similar issue.

```auto
IDX10500: Signature validation failed. Unable to resolve SecurityKeyIdentifier: 'SecurityKeyIdentifier
   (
   IsReadOnly = False,
   Count = 1,
   Clause[0] = System.IdentityModel.Tokens.NamedKeySecurityKeyIdentifierClause
   )
',
token: '{"alg":"HS256","typ":"JWT","kid":"d4475260-88c4-4df9-82ca-b4f20000ec5a"}.{"exp":1645529349,"iat":1645527549,"jti":"716d29b1-0e51-42c7-ac1d-48b391a673fd","iss":"http://localhost:8080/realms/mirsal","aud":"http://localhost:8080/realms/mirsal","sub":"c0f5c079-f104-42ce-ad23-a6c727084c82","typ":"Refresh","azp":"booqchat","session_state":"efe6ddf1-2bee-48b0-884b-88e6ddd5978e","scope":"openid email profile","sid":"efe6ddf1-2bee-48b0-884b-88e6ddd5978e"}'.

```

---

<div class="post-metadata">

**Author:** ![kttary](https://avatars.discourse-cdn.com/v4/letter/k/f1d935/32.png) [@kttary](https://forum.keycloak.org/u/kttary)\
**Post date:** [March 16, 2022, 4:11pm UTC](https://forum.keycloak.org/t/asp-net-c-error-dx10500-signature-validation-failed-unable-to-resolve-securitykeyidentifier/6567/10 "2022-03-16T16:11:22Z")

</div>

the same here… somebody has a solution pls?

---

<div class="post-metadata">

**Author:** ![codeninja2021](https://avatars.discourse-cdn.com/v4/letter/c/bbce88/32.png) [@codeninja2021](https://forum.keycloak.org/u/codeninja2021)\
**Post date:** [March 17, 2022, 3:44am UTC](https://forum.keycloak.org/t/asp-net-c-error-dx10500-signature-validation-failed-unable-to-resolve-securitykeyidentifier/6567/11 "2022-03-17T03:44:20Z")

</div>

I couldn’t find any help on the above, now I have achieved it using “OpenIdConnectAuthentication” in [ASP.NET](http://ASP.NET).

---

<div class="post-metadata">

**Author:** ![asaf](https://yyz2.discourse-cdn.com/free1/user_avatar/forum.keycloak.org/asaf/32/7387_2.png) [@asaf](https://forum.keycloak.org/u/asaf)\
**Post date:** [January 9, 2023, 11:48am UTC](https://forum.keycloak.org/t/asp-net-c-error-dx10500-signature-validation-failed-unable-to-resolve-securitykeyidentifier/6567/12 "2023-01-09T11:48:10Z")

</div>

how did you resolve this?
