Generate a new JWT public and private key

Generate a new JWT public and private key

JSON Web Tokens are becoming more and more common in single page applications and I'm also using them in multiple projects. But I also forget how to generate a new token (private and public keys). Which is a common task as you should have a different token in your development (optional test) and production environment.

If you want to store the keys in config/jwt (as you would in a symfony project), just run the following commands. You will be prompted for a password for the creation of the first and have to enter it for the second again.

openssl genrsa -out config/jwt/private.pem -aes256 4096
openssl rsa -pubout -in config/jwt/private.pem -out config/jwt/public.pem