-
-
Save azanium/fe8ae19cd9aabc5252f6fb4d7d4dcc77 to your computer and use it in GitHub Desktop.
How to generate JWT RS512 key
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ssh-keygen -t rsa -b 4096 -e SHA512 -f jwtRS512.key | |
# Don't add passphrase | |
openssl rsa -in jwtRS512.key -pubout -outform PEM -out jwtRS512.key.pub | |
cat jwtRS512.key | |
cat jwtRS512.key.pub |
Hey just found this when searching on google. Thanks for the script!
you can add -N "" to the ssh-keygen command this will force it to not ask you for a passphrase.
#!/bin/bash
echo -e "# Don't add passphrase"
ssh-keygen -t rsa -b 4096 -m PEM -E SHA512 -f jwtRS512.key -N ""
# Don't add passphrase
openssl rsa -in jwtRS512.key -pubout -outform PEM -out jwtRS512.key.pub
cat jwtRS512.key
cat jwtRS512.key.pub
And here is a one-liner which will just print a private and public key on the console and deletes the created files. Thats useful if you just want to generate a keypair really quick for testing. It does the same as the script. Just put the following in your console:
ssh-keygen -t rsa -b 4096 -m PEM -E SHA512 -f jwtRS512.key -N "" && openssl rsa -in jwtRS512.key -pubout -outform PEM -out jwtRS512.key.pub && cat jwtRS512.key && cat jwtRS512.key.pub && rm jwtRS512.key jwtRS512.key.pub
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
thanks @MaSven