# Error: RSA signing keys must be PrivateKey instances

**URL:** <https://community.auth0.com/t/error-rsa-signing-keys-must-be-privatekey-instances/106519>\
**Category:** JWT.io\
**Tags:** api, java, login\
**Created:** [May 9, 2023, 4:14pm UTC](https://community.auth0.com/t/error-rsa-signing-keys-must-be-privatekey-instances/106519 "2023-05-09T16:14:59Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![lucascardozo73](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lucascardozo73/32/47047_2.png) [@lucascardozo73](https://community.auth0.com/u/lucascardozo73)\
**Post date:** [May 9, 2023, 4:14pm UTC](https://community.auth0.com/t/error-rsa-signing-keys-must-be-privatekey-instances/106519/1 "2023-05-09T16:14:59Z")

</div>

When i try to post my login with user and password, the only return is:  
RSA signing keys must be PrivateKey instances.

What should i do to solve it?

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [May 9, 2023, 6:15pm UTC](https://community.auth0.com/t/error-rsa-signing-keys-must-be-privatekey-instances/106519/2 "2023-05-09T18:15:49Z")

</div>

Hey there @lucascardozo73 welcome to the community!

Are you able to elaborate a bit here on where and how exactly you are getting this error? The more details you can provide the better.

Thanks!

---

<div class="post-metadata">

**Author:** ![lucascardozo73](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lucascardozo73/32/47047_2.png) [@lucascardozo73](https://community.auth0.com/u/lucascardozo73)\
**Post date:** [May 9, 2023, 6:21pm UTC](https://community.auth0.com/t/error-rsa-signing-keys-must-be-privatekey-instances/106519/4 "2023-05-09T18:21:39Z")

</div>

So, i am trying to implement this new way of authentication, and i was following this one tutorial:

> **[Implementando autenticação baseada em JWT em uma API RESTful JAX-RS](https://www.treinaweb.com.br/blog/implementando-autenticacao-baseada-em-jwt-em-uma-api-restful-jax-rs)**
>
> Segurança é um item essencial e uma forma de limitar o acesso da aplicação é através de autenticação, que uma API JAX-RS pode implementar através do JWT.

my code is pretty much exactly the same as displayed, only changed the user and password.

but, when i try to run a request using insomnia, it returns the error, like this:

 ![image](https://global.discourse-cdn.com/auth0/original/3X/6/e/6e5f9171392f3cf09ad0f0d254a9f8291af350d1.png)

---

<div class="post-metadata">

**Author:** ![lucascardozo73](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/lucascardozo73/32/47047_2.png) [@lucascardozo73](https://community.auth0.com/u/lucascardozo73)\
**Post date:** [May 10, 2023, 11:36am UTC](https://community.auth0.com/t/error-rsa-signing-keys-must-be-privatekey-instances/106519/5 "2023-05-10T11:36:49Z")

</div>

Just fixed it, turns out i was using Keys.hmacShaKeyFor with the Signature Algorithm RS512, just changed it to HS256 and it solved the problem

---

<div class="post-metadata">

**Author:** ![ty.frith](https://sea1.discourse-cdn.com/auth0/user_avatar/community.auth0.com/ty.frith/32/58484_2.png) [@ty.frith](https://community.auth0.com/u/ty.frith)\
**Post date:** [May 10, 2023, 3:50pm UTC](https://community.auth0.com/t/error-rsa-signing-keys-must-be-privatekey-instances/106519/6 "2023-05-10T15:50:01Z")

</div>

Hey @lucascardozo73 that’s great! I’m glad to hear you were able to resolve this and thanks for following up with the community 😄

---

<div class="post-metadata">

**Author:** ![system](https://global.discourse-cdn.com/auth0/original/3X/b/5/b560f266932fcce5d57f09a6595bd50518cae3f3.jpeg) [@system](https://community.auth0.com/u/system)\
**Post date:** [May 24, 2023, 3:50pm UTC](https://community.auth0.com/t/error-rsa-signing-keys-must-be-privatekey-instances/106519/7 "2023-05-24T15:50:09Z")

</div>

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