Skip to content

Instantly share code, notes, and snippets.

@zenthangplus
Last active March 17, 2024 16:26
Show Gist options
  • Star 5 You must be signed in to star a gist
  • Fork 2 You must be signed in to fork a gist
  • Save zenthangplus/55dfbe88c7c6a0633e07c01fd737be70 to your computer and use it in GitHub Desktop.
Save zenthangplus/55dfbe88c7c6a0633e07c01fd737be70 to your computer and use it in GitHub Desktop.
How to generate RS256 Key Pair for Mac & Linux
#!/usr/bin/env bash
# Generate rsa keys pair
ssh-keygen -t rsa -b 4096 -f rs256.rsa
# Don't add passphrase
openssl rsa -in rs256.rsa -pubout -outform PEM -out rs256.rsa.pub
# Done
cat rs256.rsa
cat rs256.rsa.pub
@innomatrix
Copy link

innomatrix commented Jun 25, 2023

In Ubunutu (22) the first command shall be rather:

ssh-keygen -t rsa -b 4096 -m PEM -f rs256.rsa

otherwise you might encounter: Could not read private key from rs256.rsa.

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