Windows
The public key must be in the PUB format, and the private key must be in the PPK format. On Windows, you can use PuTTYgen to create an SSH key pair in the appropriate formats. You can also use PuTTYgen to convert a private key generated using ssh-keygen into a PPK file.
PuTTYgen is a key generator tool for creating SSH keys for PuTTY. It is analogous to the ssh-keygen tool used in some other SSH implementations.
The basic function is to create public and private key pairs. PuTTY stores keys in its own format in PPK files. However, the tool can also convert keys to and from other formats.
Go to Start menu → All Programs → PuTTY → PuTTYgen.
To create a key pair, select the type of key to generate from the bottom of the screen (using SSH-2 RSA with 2048 bit key size).
Then click Generate and start moving the mouse within the window. Putty uses mouse movements to collect randomness. The exact way you are going to move your mouse cannot be predicted by an external attacker. You may need to move the mouse for some time, depending on the size of your key. As you move it, the green progress bar will advance.
Once the progress bar becomes full, the actual key generation computation takes place. This may take from several seconds to several minutes. When complete, the public key should appear in the window. You can now specify a passphrase for the key.
You should save at least the private key by clicking Save private key. It may be advisable to also save the public key, though it can be later regenerated by loading the private key (by clicking Load).
macOS and Linux
On the macOS and Linux operating systems, you can use the ssh-keygen
command to create an SSH public key and SSH private key also known as a key pair.
To create SSH keys on a macOS and Linux operating system:
- Open a command terminal.
- At the prompt, enter the following command:
ssh-keygen -t rsa -b 4096 -P "" -m PEM -f key_name
Note: key_name
is the SSH key pair file name.
3. Your private and public keys have been created as files in the current directory.