Conversion of SSH2 private key to openSSH format using PuTTYgen (2024)

Problem Statement

While working on mercurial(Version Control System), we need to generate different public/private keys for windows & Linux, which leads to have multiple keys for single user.

Solution

If we want to access mercurial through Linux with your same key as Windows, then instead of generating a new rsa key pair ,we can reuse same public/private key pair to access mercurial from linux.
Hence same repository you can access via windows or linux without creating separate public/private key pair for both.

STEPS :

Pre-requisite: There must a key pair existing in SSH2 format to access mercurial`

`

  1. Open the PuTTY Key Generator
  2. On the menu bar, click "File" -> "Load private key"
  3. Select your .ppk file
  4. On the menu bar, click "Conversions" -> "Export OpenSSH key"
  5. Save the file as (without an extension) e.g. mercurial_rsa`

You are all done. Same private key on windows can be reused(with above steps) with Linux.

Top comments (0)

Subscribe

For further actions, you may consider blocking this person and/or reporting abuse

Conversion of SSH2 private key to openSSH format using PuTTYgen (2024)

FAQs

Conversion of SSH2 private key to openSSH format using PuTTYgen? ›

Convert the public key format from SSH2 to OpenSSH

Try to find the original SSH2 public key that was provided from the user. Otherwise, use the sshldap command to output the SSH2 public key. You may need to manually insert line-breaks at the appropriate places. Save the SSH2 public key to a file (e.g. ssh2.

How do I convert PuTTY private key to OpenSSH? ›

Navigate to the folder where putty is installed.
  1. Double click on puttygen.exe to open the PuttyGen Key Generator. ...
  2. Select the private key which has to be converted to the openssh format and click on Open.
  3. 5.Now from the menu click on Conversions→Export OpenSSH key. ...
  4. The generated key will be in openssh format.

How to convert SSH2 public key to OpenSSH? ›

Convert the public key format from SSH2 to OpenSSH

Try to find the original SSH2 public key that was provided from the user. Otherwise, use the sshldap command to output the SSH2 public key. You may need to manually insert line-breaks at the appropriate places. Save the SSH2 public key to a file (e.g. ssh2.

How to convert private key to public key using PuTTYgen? ›

puttygen supports exporting your private key to an OpenSSH compatible format. You can then use OpenSSH tools to recreate the public key. Copy your private key to ~/. ssh/id_dsa (or id_rsa ).

What is the format of OpenSSH private key? ›

So, the OpenSSH private key format ultimately contains a private key encrypted with a non-standard version of PBKDF2 that uses bcrypt as its core hash function. The structure that contains the key is not ASN. 1, even though it's base64 encoded and wrapped between header and footer that are similar to the PEM ones.

How to generate public SSH key in OpenSSH format? ›

Generate an SSH Key Pair
  1. Run the ssh-keygen command. You can use the -t option to specify the type of key to create. ...
  2. The command prompts you to enter the path to the file in which you want to save the key. ...
  3. The command prompts you to enter a passphrase. ...
  4. When prompted, enter the passphrase again to confirm it.

Does OpenSSH use SSH2? ›

OpenSSH uses the SSH protocol which connects over TCP. Normally, one SSH session per TCP connection is made, but multiple sessions can be multiplexed over a single TCP connection if planned that way. The current set of Secure Shell protocols is SSH2.

What is the difference between SSH and SSH2 key? ›

SSH1 and SSH2 encrypt at different parts of the packets, and SSH1 uses server and host keys to authenticate systems where SSH2 only uses host keys. SSH2 is a complete rewrite of the protocol, and it does not use the same networking implementation that SSH1 does. Also, SSH2 is more secure.

What format is ssh-keygen conversion? ›

The supported key formats are: “RFC4716” (RFC 4716/SSH2 public or private key), “PKCS8” (PKCS8 public or private key) or “PEM” (PEM public key). By default OpenSSH will write newly-generated private keys in its own format, but when converting public keys for export the default format is “RFC4716”.

Can OpenSSH use PuTTY key? ›

With the PuTTY Key Generator you can use already existing OpenSSH keys. If the public key is already appended to the “authorized_keys” file on the remote SSH server, connect to the server with the private key. Otherwise, proceed by copying the public key to the server.

How to generate .pem file using PuTTYgen? ›

Windows - convert a . ppk file to a . pem file
  1. Start PuTTYgen. For Actions, choose Load, and then navigate to your . ...
  2. Choose the . ...
  3. (Optional) For Key passphrase, enter a passphrase. ...
  4. From the menu at the top of the PuTTY Key Generator, choose Conversions, Export OpenSSH Key. ...
  5. Name the file and add the . ...
  6. Choose Save.

How to convert PuTTY key to OpenSSH format? ›

Open PuttyGen. Click File -> Load private key. Go to Conversions -> Export OpenSSH and export your private key.

What format is PuTTY SSH private key? ›

Importantly, the private key for PuTTY is only available in the merged . ppk format. In the case of a passphrase-protected . ppk, we'd get a Enter passphrase to load key prompt.

How should a private key be formatted? ›

Private keys can be saved in the PEM format as well, “—–BEGIN PRIVATE KEY—–“/”—–END PRIVATE KEY—–” is used to denote such files. All these headers as well the detailed PEM-encoding rules are documented in this specification. ASN. 1/DER/PEM is mostly used for TLS implementation and whenever X.

How to connect SSH with private key PuTTY? ›

Connect to Server with Private Key

The PuTTYgen tool can be closed and PuTTY launched again. Enter the remote server Host Name or IP address under "Session". Navigate to "Connection" > "SSH" > "Auth". Click "Browse..." under "Authentication parameters" / "Private key file for authentication".

Can PuTTY use the OpenSSH key? ›

The PuTTY SSH client for Microsoft Windows does not use the same key format as the OpenSSH client. If you want to use PuTTY, you have to create a new SSH public and private key using the PuTTYgen tool or convert an existing OpenSSH private key.

Can OpenSSH use PPK? ›

ppk format isn't directly compatible with OpenSSH clients. After discussing the types and some formats for SSH keys, let's see how we can convert between them. Of course, all steps with puttygen also work in the GUI version of the tool.

How to convert ppk file? ›

Convert an SSH key to PPK format
  1. Make sure that PuTTY is installed on your device.
  2. Launch the PuTTYgen app.
  3. Click Load. ...
  4. PuTTYgen will prompt you to confirm that you want to import the key. ...
  5. Select a converted key by clicking either Save private key or Save public key.
  6. Save the key on your device for future use.

Top Articles
Latest Posts
Article information

Author: Sen. Ignacio Ratke

Last Updated:

Views: 6200

Rating: 4.6 / 5 (76 voted)

Reviews: 83% of readers found this page helpful

Author information

Name: Sen. Ignacio Ratke

Birthday: 1999-05-27

Address: Apt. 171 8116 Bailey Via, Roberthaven, GA 58289

Phone: +2585395768220

Job: Lead Liaison

Hobby: Lockpicking, LARPing, Lego building, Lapidary, Macrame, Book restoration, Bodybuilding

Introduction: My name is Sen. Ignacio Ratke, I am a adventurous, zealous, outstanding, agreeable, precious, excited, gifted person who loves writing and wants to share my knowledge and understanding with you.