ssl-key-conversion

SmartGit won’t accept my ssh password…because it wants OpenSSH format

I was cloning a repository from github via SmartGit and encountered an issue when issuing the password to the private ssl key that I needed to use. There was no error, the dialog box just refreshed asking for my password again. After triple checking and being sure i was issuing the pass correctly I realized Smartgit wanted a key in OpenSSH format (mine was SSH2). To convert you’ll need to install OpenSSH if not already installed:

sudo apt-get install openssh-client

Then to convert a private SSH2 key to OpenSSH do:

ssh-keygen -i -f path/to/.ssh/private.key > path/to/new/opensshprivate.key

To convert the public key just change the extensions:

ssh-keygen -i -f path/to/.ssh/public.pub >> path/to/opensshpublic.pub

The magic is in the flags, the -i tells SSH to read an SSH2 key and convert it into the OpenSSH format and the -e flag tells SSH to read an OpenSSH key file and convert it to SSH2. In this way you can reverse the process and convert OpenSSH to SSH2:

ssh-keygen -e -f path/to/opensshprivate.key > path/to/sshprivate.key

Leave a Reply

Your email address will not be published. Required fields are marked *