How to create a keypair with OpenSSH KeyGen?

Host Key Not Cached Putty

How to create a keypair with OpenSSH KeyGen?

About

Keygen 1) is a OpenSSH tool that generates a new ssh keypair suitable for public key authentication

How to create a keypair

Install OpenSSH

Install OpenSsh

Start KeyGen

Run ssh-keygen to create a keypair

ssh-keygen -m PEM -t rsa
# or
ssh-keygen -t ed25519

where:

  • -t is the algorithm (implementation) (Default to RSA):
    • DSA,
    • RSA,
    • ECDSA,
    • or Ed25519
  • -m define the format (By default OpenSSH create private keys in its own format, see the header)
    • RFC4716: RFC 4716/SSH2 public or private key
    • PKCS8: PKCS8 public or private key
    • PEM: PEM public key (openssl format)

Enter a location and a passphrase

Enter a passphrase to protect it, store your passphrase in a keystore client application such as keypass or Bitwarden

Output on Windows:

Generating public/private rsa key pair.
Enter file in which to save the key (C:\Users\ngera/.ssh/id_rsa): C:\Users\ngera\.ssh\keyname_rsa
Enter passphrase (empty for no passphrase):
Enter same passphrase again:

Result

Your identification has been saved in C:\Users\ngera\.ssh\keyname_rsa
Your public key has been saved in C:\Users\ngera\.ssh\keyname_rsa.pub
The key fingerprint is:
SHA256:LKQaKFnxxxxxxxao/RdPNkJ0Yq//Jiaaxxxxxsv93lk username@hostname
The key's randomart image is:
+---[RSA 3072]----+
|     .o o.=  +=o.|
| o   o + * o .+o.|
|  = . o + . o .. |
| xxxxxxxxxxx .   |
|+ o . . S   .    |
|.  o   .     .   |
|  .       xxxxxx |
|      . .. ooo=  |
|       ==o=B+=.. |
+----[SHA256]-----+

where:

Next as client

If you are a client, add it to your authentication agent

Example:

ssh-add $env:USERPROFILE\.ssh\keyname_rsa





Discover More
Public Key Crypto Pair Key Creation
Cryptographic - Private Key

This article talks the secret known as the private key in a asymmetric cryptographic scheme. A private key is a cryptographic key that is private (that you should keep secret). This page is how to...
Public Key Crypto Pair Key Creation
Keypair (public and a private key)

A keypair is a pair of keys: a public key: Used for encryption or signature verification; and a private one: The decryption key which is kept secret decrypt and sign. They are a component of the...
Windows Install Openssh
OpenSSH

() is a combination of command line utility to implement and use SSH ssh is the SSH client component that runs on the user's local system sshd is the SSH server component...
Host Key Not Cached Putty
What are Host Keys?

Host keys are a key pairs for a host. Each host can have one host key for each algorithm. You should get an SSH host key fingerprint along with your credentials from a server administrator in order...
Git Open Ssh
What is OpenSSH ssh-agent?

ssh-agent is the authentication agent of Openssh. It stores un/desencrypted private keys in memory, and communicates with SSH clients via Unix_domain_socket you don't get a ssh-agent Unix Socket...



Share this page:
Follow us:
Task Runner