Public Key authenication - WeOnlyDo Discussion board

Public Key authenication (wodSFTP / wodSFTP.NET / wodSFTPdll)

by imper, Thursday, June 16, 2005, 16:19 (7100 days ago)

I plan to implement public key auth with keys generated on the server and then installed on the client. There does not appear to be an explanation of how to do this in the documentation (though it looks like it's supported), so it would really helpful to see how it's done.

Kind regards!

Re: Public Key authenication

by wodSupport, Thursday, June 16, 2005, 16:29 (7100 days ago) @ imper

Imper,

since it's exactly the same as in wodSSH and wodSFTP, I suggest you look at that forum.

Anyway, you will need to use wodKeys, and calls it's Generate method. Then use wodKeys.PublicKeyOpenSSH to retrieve public key, and transfer that public key on the server to appropriate file (~/.ssh/authorized_keys2 usually). After that, do something like this:

SShTunnel.Authentication = authPubKey
Dim k as new wodKeys
k.Load your_saved_key , your_password
SshTunnel.PrivateKey = k
SshTunnel.Login = your_login
....

and connect. That should be it.

Hope it helps.

Re: Public Key authenication

by imper, Friday, June 17, 2005, 03:53 (7099 days ago) @ wodSupport

My problem is that I amd using Delphi 7, and it won't let me treat wodkeys.dll like an activex control. I don't think I need it anyway. I generated the keys on the server and verified that they work. I then copied the private key into a memo on the app and tried to log in, and the login failed. Is there something I have to do with the key to pass it to the server? Here's my code for your review:

wodTunnel1.Hostname := Edit1.Text;
wodTunnel1.Port := 22;
wodTunnel1.Protocol := SSHAuto;

wodTunnel1.Login := 'testuser';
wodTunnel1.PrivateKey := Memo1.Text;
wodTunnel1.Authentication := authPubkey;

Regards!

Re: Public Key authenication

by wodSupport, Friday, June 17, 2005, 12:09 (7099 days ago) @ imper

Can you send me such app with predefined settings, so I can try to connect using your code? It could be that data is lost on binary conversion between your memo field and privatekey property.

Re: Public Key authenication

by imper, Friday, June 17, 2005, 17:30 (7099 days ago) @ wodSupport

Ok, I sent you a copy of the whole project this am with a precompiled executable. I am passing the rsa private key as a text object.

regards