-
Star
1,195
You must be signed in to star a gist -
Fork
268
You must be signed in to fork a gist
-
-
Save ygotthilf/baa58da5c3dd1f69fae9 to your computer and use it in GitHub Desktop.
ssh-keygen -t rsa -b 4096 -m PEM -f jwtRS256.key | |
# Don't add passphrase | |
openssl rsa -in jwtRS256.key -pubout -outform PEM -out jwtRS256.key.pub | |
cat jwtRS256.key | |
cat jwtRS256.key.pub |
Thanks
thanks
Thanks a lot !
thanks
I cannot believe the amount of time and frustration it took to FINALLY stumble upon this amazing post, and the equally amazing comments that provided additional clarity. IMO, while fully acknowledging that the actual generation of public/private keys using openssl/ssh-keygen is beyond scope for node-jsonwebtoken docs, still, it would be a great service to their user base, to if not actually include the few lines required to properly create compatible public/private keys, to at least maybe add references/links to CLEAR, helpful resources LIKE THIS!
Thanks ALOT to the OP, and everyone who contributed!
T. H. A. N. K. S. 🙏
Use this command to convert the keys to one line string
awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' jwtRS256.key
awk 'NF {sub(/\r/, ""); printf "%s\\n",$0;}' jwtRS256.key.pub
Thank you indeed!
Thanks
thanks
Thanks!
I think this link resolve also this problem.
https://symfony.com/bundles/LexikJWTAuthenticationBundle/current/index.html
thank you.
Thanks! What if I need to use the private key associated to a Metamask wallet to sign? Can I do it by manipulating the key or do I need another type of key altogether?
Thanks
Thanks!
BTW @ygotthilf you can add -N ''
to ssh keygen and it will not even ask for passphrase
awesome!!! Thx
Thanks! Nice and easy!
Awesome, thank youuu
many thanks
save my day, thanks
Thanks
Now, it doesn't work because newer version of
ssh-keygen
no longer usesPEM
format as default key format. It have changed toRFC4716
for default key format. Thus, I have to setPEM
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.
many thanks
thank you good sir!
Thanks :)
nice
oh hell yeah
concise and useful :)
thx
thanks!
Thanks
Thanks!! Amazing!
let me contribute to the thanks
Thanks
Thanks