Skip to content

Instantly share code, notes, and snippets.

@iMega
Last active May 19, 2021 09:50
Show Gist options
  • Save iMega/75d1e599df5d240d2134e8315965f563 to your computer and use it in GitHub Desktop.
Save iMega/75d1e599df5d240d2134e8315965f563 to your computer and use it in GitHub Desktop.
How to generate RS256 Key Pair for Mac & Linux with passphrase

Without passphrase

Generate rsa keys pair and don't add passphrase

ssh-keygen -t rsa -b 4096 -f rs256.rsa
openssl rsa -in rs256.rsa -pubout -outform PEM -out rs256.rsa.pub
cat rs256.rsa
cat rs256.rsa.pub

With passphrase

ssh-keygen -t rsa -b 4096 -m PEM -f rs256.rsa
openssl rsa -in rs256.rsa -pubout -outform PEM -out rs256.rsa.pub
cat rs256.rsa
cat rs256.rsa.pub
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment