Skip to content

Instantly share code, notes, and snippets.

@feinoujc
Created March 1, 2018 19:00
Show Gist options
  • Save feinoujc/5d3fa7190147d0a821d30f71d4b3cf3f to your computer and use it in GitHub Desktop.
Save feinoujc/5d3fa7190147d0a821d30f71d4b3cf3f to your computer and use it in GitHub Desktop.
#!/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 4096 && openssl rsa -in $KEYNAME-private.key -outform PEM -pubout -out $KEYNAME-public.pem
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment