LIBSSH2_ERROR_FILE: Unable to extract public key from private key

Get help for specific problems
Posts: 2
Joined: 30 Jun 2017

dims

What is correct PEM file format for FreeFileSync?

I tried to do various exports from PuttyGen, including private key, public key, OpenSSH format, SSH.COM format, but neither worked.

Reported error is

LIBSSH2_ERROR_FILE: Unable to extract public key from private key

How to fix? What is correct PEM format FreeFileSync expected?
User avatar
Site Admin
Posts: 7283
Joined: 9 Dec 2007

Zenju

In short: "whatever libssh2" accepts.
Practically the RSA or DSA private SSH keys should work (e.g. as generated by cPanel for web hosting).
If it helps, I'm currently also working on Pageant support as a third way of SFTP authentication.
Posts: 2
Joined: 30 Jun 2017

dims

I have the following file

https://i.imgur.com/p0cPhkn.png

and it doesn't work.
User avatar
Site Admin
Posts: 7283
Joined: 9 Dec 2007

Zenju

The file format certainly looks correct.
Posts: 2
Joined: 23 Jul 2017

redstamp

Have the same issue...worked once and now I cant get it to work again... not as clued up as dims, but get exactly same error... my public key looks like this...:
---- BEGIN SSH2 PUBLIC KEY ----
Comment: "rsa-key-20170801"
***************************************************
***************************************************
***************************************************
***************************************************
***************************************************
********************************************
---- END SSH2 PUBLIC KEY ----

I generated mine with PuttyGen, but presume that's not the issue as it worked once...
Posts: 2
Joined: 23 Jul 2017

redstamp

Strangely pageant worked though... pls explain if you have time
Posts: 1
Joined: 15 Jan 2018

ProCycle

I ran into the same error. Fixed it by opening the private ppk key file in PuttyGen and choosing Conversions -> Export OpenSSH key and save the resulting file.