Create an RSA or SSH key pair
Learn how to create an RSA or SSH key pair
On this page· 5 sections
Generating an RSA key pair is essential for encrypting and decrypting sensitive data securely. This guide provides step-by-step instructions for generating an RSA key pair using the command line.
Creating an RSA keypair#
OpenSSL is a widely-used toolkit for the TLS and SSL protocols. It can also be used to generate RSA key pairs.
Creating an RSA key pair on the command line using OpenSSL#
Generate the Private Key:
ShellExtract the Public Key:
ShellView the Private Key:
ShellView the Public Key:
Shell
Creating an SSH keypair#
ssh-keygen is a tool for creating new authentication key pairs for SSH. Such key pairs are used for automating logins, single sign-on, and for authenticating hosts.
Creating an SSH key pair in Linux or macOS using ssh-keygen#
Generate the key pair:
ShellView the Public key for pasting:
Shell
Creating an SSH key pair in Windows using PuTTygen#
- Download PuTTy Key Generator PuTTygen.exe file and run it.
- In the Key menu, select SSH-2 RSA Key
- In Parameters, select the RSA option.
- In Number of bits in generated key field, enter 4096
- In Actions, select Generate
- In the blank area under the progress bar, move your pointer in a random pattern to complete key pair generation.
- When generation completes, copy the contents of the Public key for pasting