Ssh-keygen

Component of Secure Shell


title: "Ssh-keygen" type: doc version: 1 created: 2026-02-28 author: "Wikipedia contributors" status: active scope: public tags: ["operating-system-security", "unix-network-related-software", "secure-shell"] description: "Component of Secure Shell" topic_path: "technology/operating-systems" source: "https://en.wikipedia.org/wiki/Ssh-keygen" license: "CC BY-SA 4.0" wikipedia_page_id: 0 wikipedia_revision_id: 0

::summary Component of Secure Shell ::

::data[format=table title="Infobox software"]

FieldValue
namessh-keygen
developerThe OpenBSD Project
repo
programming languageC
operating systemUnix, Unix-like, Microsoft Windows
genreCommand
licenseBSD, ISC, public domain
website
::

| name = ssh-keygen | logo = | screenshot = | screenshot size = | caption = | developer = The OpenBSD Project | released = | latest release version = | latest release date = | repo = | programming language = C | operating system = Unix, Unix-like, Microsoft Windows | genre = Command | license = BSD, ISC, public domain | website = ssh-keygen is a standard component of the Secure Shell (SSH) 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. To provide for unattended operation, the passphrase can be left empty, albeit at increased risk. 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

Example: ssh-keygen -t rsa ::data[format=table] | Protocol | -t option || Creation Date | Status in 2025 | |---|---|---| | RSA | rsa | 1977 | | DSA | dsa | 1991 | | ECDSA | ecdsa | 1999 | | EDDSA | ed25519 | 2005 | ::

Originally, with SSH protocol version 1 (now deprecated) 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 (this key format no longer uses the previous PEM file format for private keys, nor does it depend upon the OpenSSL library to provide the cryptographic implementation).

A fourth format is supported using Ed25519, originally developed by independent cryptography researcher Daniel J. Bernstein.

Command syntax

The syntax of the ssh-keygen command is as follows:

ssh-keygen [options]

Some important options of the ssh-keygen command are as follows:

::data[format=table]

ssh-keygen command optionsdescription
-b bitsSpecifies the number of bits in the key to create. The default length is 3072 bits (RSA) or 256 bits (ECDSA).
-C commentProvides custom key comment (which will be appended at the end of the public key).
-KImports a private resident key from a FIDO2 device.
-pRequests changing the passphrase of a private key file instead of creating a new private key.
-tSpecifies the type of key to create (e.g., rsa).
-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.
-BDumps the key's fingerprint in Bubble Babble format.
-lDumps the key's fingerprint in SHA-2 (or MD5) format.
::

Files used by the ssh-keygen utility

The ssh-keygen utility generates files for storing public and private keys. Note : they are stored in $HOME/.ssh/ as follows:

SSH protocol version 2

::data[format=table title="Quick Recap"]

AlgorithmPrivatePublic
RSAid_rsaid_rsa.pub
DSAid_dsaid_dsa.pub
ECDSAid_ecdsaid_ecdsa.pub
ed25519id_ed25519id_ed25519.pub
::
  • The file contains the protocol version 2 DSA authentication identity of the user.
  • The file contains the DSA public key for authentication when you are using the SSH protocol version 2.
    • A user should copy its contents in the file of the remote system where a user wants to log in using DSA authentication.
  • The file contains the protocol version 2 RSA authentication identity of the user.
    • This file should not be readable by anyone but the user.
  • The file contains the protocol version 2 RSA public key for authentication.
    • The contents of this file should be added to on all computers where a user wishes to log in using public key authentication.

SSH protocol version 1

  • The file contains the RSA private key when using the SSH protocol version 1.
  • The file contains the RSA public key for authentication when you are using the SSH protocol version 1.
    • A user should copy its contents in the file of the remote system where a user wants to log in using RSA authentication.

References

References

  1. (8 March 2018). "What's new for the Command Line in Windows 10 version 1803".
  2. (15 December 2017). "Using the OpenSSH Beta in Windows 10 Fall Creators Update and Windows Server 1709".
  3. "SSH-keygen(1) - Linux manual page".
  4. "Withdrawn NIST Technical Series Publication".
  5. (26 July 2021). "How Hackers Can Exploit Weak ECDSA Signatures".
  6. "Comparing SSH Keys - RSA, DSA, ECDSA, or EdDSA?".

::callout[type=info title="Wikipedia Source"] This article was imported from Wikipedia and is available under the Creative Commons Attribution-ShareAlike 4.0 License. Content has been adapted to SurfDoc format. Original contributors can be found on the article history page. ::

operating-system-securityunix-network-related-softwaresecure-shell