Help with private key

Feb 4, 2013 at 1:34 PM
I use ssh-keygen -t rsa to generate my key on my Linux server. I then use:
Dim keyFile = New PrivateKeyFile(File.OpenRead("c:\temp\keyfile"), "phrase")
    Using client As New SshClient(strServerIP, 22, strAccount, keyFile)

        client.Connect()
I keep getting an error like my password is bad. If I just replace the keyfile and put the password there it works fine. What am I missing to get the private key to work?

Thanks Chad
Coordinator
Feb 4, 2013 at 1:58 PM
Hi,

I am little confused by your questions.
So does everything works fine now or only when you use pass phrase with private key?
Also, can you be more specific with what error it says and also if you in debug mode where it occurs?

Thanks,
Oleg
Feb 4, 2013 at 2:09 PM
Sorry, can't get the private key to work with or without a phrase. If I just enter the password in plain text, it works fine.

Using client As New SshClient(strServerIP, 22, strAccount, "mypassword") 'this works

It's looks like I do generate a valid key on my server. The code errors out on the client.Connect() command. It shows an error telling me "User cannot be authenticated" when I try to use a private key.
Coordinator
Feb 4, 2013 at 2:29 PM
Hmm,
Did you try to generate different private key on different machines?
Just want to make sure its not something machine specific.

It appears what happens it cannot validate this private key for some reason and errors you out.
The problem with private key is that if you provide a wrong pass phrase or key it wont be able to tell if key or pass phrase is wrong but will go ahead and try to authenticate.
So I guess I would just double check key and pass phrase or to create a new one if possible and see if it works.

If its not mission critical, you can send me info privately and I can take a look at it if you like.

Hope it helps,
Thanks,
Oleg