Key authentication - WeOnlyDo Discussion board

Key authentication (General questions)

by BrianG, Monday, March 25, 2019, 15:22 (148 days ago)

Good morning,

We have a client who is setting us up to use their SFTP server and are requiring key authentication. We have your WeOnlyDo FTPDLX.NET product (v1.8.1.236), which I thought I had seen somewhere on your site supports key authentication, but now I'm seeing posts that indicate I would need to purchase the SSH ActiveX too? Can you please clarify that for me?

Secondarily, our client has initially sent us a public key, isn't it typical that we would send them a public key first? Can you tell me the basic steps to follow if they send us one first?

Thanks very much for any help you can provide!
Brian

Key authentication

by Jasmine, Monday, March 25, 2019, 15:30 (148 days ago) @ BrianG

Hi Brian,

wodFtpDLX.NET can do publickey-authentication in SFTP protocol, this is not a problem. You need private key to authenticate, public key is not enough.

Code is more less like this:


dlx1 = new WeOnlyDo.Client.FtpDLX();
key = new WeOnlyDo.Security.Cryptography.KeyManager();
key.Load("private.txt");
dlx1.Hostname = "xxx";
dlx1.Authentication = WeOnlyDo.Client.Authentications.PublicKey;
dlx1.Protocol = WeOnlyDo.Client.Protocols.SFTP;
dlx1.Login = "xxx";
dlx1.PrivateKey = key.ToXmlString(WeOnlyDo.Security.Cryptography.SSHKeyTypes.RSAKey, true);
dlx1.Blocking = true;
dlx1.Connect();

I hope this helps!
Jasmine.

Key authentication

by BrianG, Tuesday, March 26, 2019, 13:56 (147 days ago) @ Jasmine

Thanks Jasmine,

I discovered I hadn't loaded the WeOnlyDo.Security reference, newbie mistake!

So in order to first create the key pair, I do something like this:

key.Generate(WeOnlyDo.Security.Cryptography.SSHKeyTypes.RSAKey, 1024)
key.Save(KeyDir & "\WODkey.pri", "password")
Dim PubKey As String = key.PublicKeyOpenSSH(WeOnlyDo.Security.Cryptography.SSHKeyTypes.RSAKey)
My.Computer.FileSystem.WriteAllText(KeyDir & "\WODkey.pub", PubKey, False)

Once I've run that and it has created both the private and public key files, I'm done with that code, correct? Then I send the public key file to the server, where it is set as the key file for my userid. Then in order to connect, I just need to Load the private key and set the PrivateKey property to it as in your example below?

Assuming that is all correct, I am getting an "Authentication with the server failed." error and my server log reports a "key-check failure", can you shed any light on that?

Thanks again,

Brian

Key authentication

by Jasmine, Tuesday, March 26, 2019, 14:58 (147 days ago) @ BrianG

Brian,

correct. Where did you save public key on the server? BTW this key can be used with other tools, you can import it, for example, to Putty using PuttyGen, does it work from Putty then?

Jasmine.