How to create an FTPS connection


I have successfully connected to a remote host using the SmartFTP client. The connection is set up as FTPS (Explicit) with anonymous login with a client certificate enabled. All is working well.

However, I have to re-create this scenario using sfFTPLib and am having a hard time reading the c# samples and the documentation as to how to setup the connection. No samples seem to fit my requirements and the documentation leaves me even more confused.

Any starting help would be much appreciated.

Best regards

What language do you use? C#?

C#, yes could also do for examples

Please install the latest version of the ftp library:

It comes with an updated c# sample which shows how to select the protocol and client certificate.

Thank you. I will try to work with that.

Please note that the provided C# example doesn't compile, although not tested yet, it should read something like

System.Array certificateThumbprint = Array.CreateInstance(typeof (byte), 20);
certificateThumbprint.SetValue(0x12, 0);
certificateThumbprint.SetValue(0x34, 1);
// etc
_ftp.SSLSocketLayer.ClientCertThumbprint = Convert.ToBase64String((byte[]) certificateThumbprint);

I think you still have the old version of the sfFTPLib.dll or the old interop. ClientCertThumbprint takes now a System.Array in c#, SAFEARRAY(BYTE) in c++.