Ssh-keygen


ssh-keygen is a standard component of the Secure Shell protocol suite found on Unix, Unix-like and Microsoft Windows computer systems used to establish secure shell sessions between remote computers over insecure networks, through the use of various cryptographic techniques. The ssh-keygen utility is used to generate, manage, and convert authentication keys.

Overview

ssh-keygen is able to generate a key using one of three different digital signature algorithms. With the help of the ssh-keygen tool, a user can create passphrase keys for any of these key types. These keys differ from keys used by the related tool GNU Privacy Guard.
OpenSSH-based client and server programs have been included in Windows 10 since version 1803. The SSH client and key agent are enabled and available by default and the SSH server is an optional Feature-on-Demand.

Key formats supported

Originally, with SSH protocol version 1 only the RSA algorithm was supported. As of 2016, RSA is still considered strong, but the recommended key length has increased over time.
The SSH protocol version 2 additionally introduced support for the DSA algorithm. DSA is now considered weak and was disabled in OpenSSH 7.0.
Subsequently, OpenSSH added support for a third digital signature algorithm, ECDSA.
A fourth format is supported using ed25519, originally developed by independent cryptography researcher Daniel J. Bernstein.

ssh-keygen command syntax

The syntax of the ssh-keygen command is as follows:
ssh-keygen
Some important options of the ssh-keygen command are as follows:
ssh-keygen command optionsdescription
-b bitsSpecifies the number of bits in the key to create. The minimum bit length is 1024 bits and the default length is 2048 bits.
-C commentProvides new comment.
-pRequests changing the passphrase of a private key file instead of creating a new private key.
-tSpecifies the type of key to create.
-oUse the new OpenSSH format.
-qquiets ssh-keygen. It is used by the /etc/rc file while creating a new key.
-NProvides a new Passphrase.
-F For ssh-keygen2, dumps the key's fingerprint in Bubble Babble format

Files used by the ssh-keygen utility

The ssh-keygen utility uses various files for storing public and private keys. The files used by ssh-keygen utility are as follows: