Skip to content

Instantly share code, notes, and snippets.

@renatomefi
Last active May 28, 2019 08:29
Show Gist options
  • Star 7 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save renatomefi/c3500b7ceb08e130058bd58a02c46453 to your computer and use it in GitHub Desktop.
Save renatomefi/c3500b7ceb08e130058bd58a02c46453 to your computer and use it in GitHub Desktop.
Generate RS256 JWT keys to use at jwt.io
#!/bin/bash
# This will write private.pem and public.pem in the current directory
# The default key strenght is 2048 bits
# usage:
# # ./gen-jwt-rsa-keys.sh mykey
# # ls
# gen-jwt-rsa-keys.sh mykey-private.key mykey-public.pem
# first time you have to give execution permission or use bash and the filename
# # chmod +x gen-jwt-rsa-keys.sh
KEYNAME=${1:-jwtrsa}
openssl genrsa -out $KEYNAME-private.key 2048 && openssl rsa -in $KEYNAME-private.key -outform PEM -pubout -out $KEYNAME-public.pem
@mvanholsteijn
Copy link

this has nothing to do with JWT. this is just a script generating a private RSA key,

@ikenfin
Copy link

ikenfin commented Nov 28, 2018

Thanks, that's was helpful!

@victor-geere
Copy link

Splendid

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