"Invalid private key file" error with a usable private key

Oct 13, 2011 at 4:10 PM

Hey, there.

I'm trying to use the library to upload files via FTP and get this error. I don't have a lot of background in SSH, so my questions may seem obvious to some.

Currently I'm trying to use private key file that I use with WinSCP and Putty, but it's throwing the error above. Do I need some other key file to get this to work? Thanks!

Oct 13, 2011 at 5:29 PM

My apologies, I was using the wrong key. Exported it as OpenSSH and PrivateKey instantiation worked. Working through some other issues

Dec 8, 2011 at 6:39 PM

For anyone else that is having errors getting a private key set up, here are the commands I used to get my private key set up.

I had started with CygWin using ssh-keygen, but when using a passphrase, I found that this output a private key with encryption that is not compatible with this library at this time. Instead, download the latest windows port of OpenSSL and install it. Then run the following commands:

openssl.exe genrsa -des3 -out id_key 1024

Provide the password when asked. Then you can use ssh-keygen to output the public key of this file:

ssh-keygen -y -f id_key > id_key.pub

Copy this public key into to the authorized_keys file on your server and you should be all set.