3

I have private key (not RSA) and i want to generate JWT using <jwt.io> using RS256. How can I generate a token?

Whenever I enter my private key it says invalid signature. If I need to pass RSA private key then how to convert my private key to RSA private key? I am totally new to this.

2
  • My private goes like: "-----BEGIN PRIVATE KEY-----\nMIIEvgIBADA.......Mh\n-----END PRIVATE KEY-----". Commented May 16, 2021 at 13:15
  • If you don't have an RSA private key then you can't use RS256. There is no sensible way to convert a private key from a different public key cryptosystem into an RSA private key. The few characters of your PEM encoded private key that you have provided don't contain enough information to determine the type of private key. Commented May 16, 2021 at 13:59

1 Answer 1

3

RS256 is an asymmetric signature algorithm, that means you need a keypair consisting of private and public key. You can generate such a pair with various online tools or with openssl. To generate (i.e sign) a token, you need the private key. But for verification, you need the public key. As long as you only paste the private key into the field in the right column, JWT.io can sign a token, but can't verify it. Therefore paste both keys of the pair into the key fields to get your token signed and verified.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.