Skip to content

Instantly share code, notes, and snippets.

Last active November 24, 2023 20:16
Star You must be signed in to star a gist
What would you like to do?
How to generate JWT RS256 key
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key
# Don't add passphrase
openssl rsa -in jwtRS256.key -pubout -outform PEM -out
cat jwtRS256.key
Copy link

mtwsec commented Jun 13, 2023

Thanks! Nice and easy!

Copy link

ziyaDev commented Jun 22, 2023

Awesome, thank youuu

Copy link

many thanks

Copy link

save my day, thanks

Copy link


Copy link

Now, it doesn't work because newer version of ssh-keygen no longer uses PEM format as default key format. It have changed to RFC4716 for default key format. Thus, I have to set PEM format explicitly :

ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key

This will work 👍

In case anyone is getting an error from openssl, try this.

Copy link

many thanks

Copy link

thank you good sir!

Copy link

Thanks :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment