Skip to content

Instantly share code, notes, and snippets.

@xros
Last active February 9, 2022 01:30
Show Gist options
  • Save xros/784dc6029a05a572e08f76a19cacd5ab to your computer and use it in GitHub Desktop.
Save xros/784dc6029a05a572e08f76a19cacd5ab to your computer and use it in GitHub Desktop.
generate JWT RSA256 key pair using openssl
# This RSA256 key is of 2048 bits long (valid between 1024-4096)
openssl genrsa -out jwtRSA256.private.key 2048
openssl rsa -in jwtRSA256.private.key -pubout -out jwtRSA256.public.key
# no need to input passphrase
cat jwtRSA256.private.key
cat jwtRSA256.public.key
# notice the jwtRSA256.public.key is in ssh-rsa format
@xros
Copy link
Author

xros commented Feb 9, 2022

NOTICE for PEM public key

For generating PEM public key, use this
-outform PEM

openssl rsa -in jwtRSA256.private.key -outform PEM -pubout -out jwtRSA256.public.key

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