Last active
April 17, 2025 20:54
-
-
Save stephenchew/9f670e7791f1ca94fea4d1852668a51e to your computer and use it in GitHub Desktop.
Generate private/public key (RSA format)
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
| # Convert 4096-bit OpenSSH private key to RSA format | |
| # Input -----BEGIN OPENSSH PRIVATE KEY----- b3BlbnNz...QECAwQ= -----END OPENSSH PRIVATE KEY----- | |
| # Output -----BEGIN RSA PRIVATE KEY----- MIICXAI...OsuOpw= -----END RSA PRIVATE KEY----- | |
| ssh-keygen -p -m pem -f private-key-file-name | |
| # Convert given pub file to PEM format | |
| # Input ssh-rsa AAAAB3NzaC1yc2EAAAADAQA....== [email protected] | |
| # Ouput -----BEGIN RSA PUBLIC KEY----- MIGJAoG...gMBAAE= -----END RSA PUBLIC KEY----- | |
| ssh-keygen -f public-key.pub -e -m pem |
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
| # Generate 4096-bit RSA with given alias in OpenSSH format | |
| ssh-keygen -t rsa -b 4096 -C <alias-goes-here> | |
| # Output public key from private key (OpenSSH) | |
| ssh-keygen -y -f output.pub |
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
| # Convert RSA private key to OpenSSH format | |
| # NOTE: The original PEM file will be overwritten. Make sure you have a backup | |
| # Input -----BEGIN RSA PRIVATE KEY----- MIICXAI...OsuOpw= -----END RSA PRIVATE KEY----- | |
| # Output -----BEGIN OPENSSH PRIVATE KEY----- b3BlbnNz...QECAwQ= -----END OPENSSH PRIVATE KEY----- | |
| ssh-keygen -p -N "" -f rsa-format.pem |
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
| # Generate 4096-bit RSA with given alias in RSA format | |
| ssh-keygen -t rsa -b 4096 -C <alias-goes-here> -m pem |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Fmcgzs