How to create an FTPS connection

This forum is not monitored by the SmartFTP staff. If you have a license please contact technical support by email.
Post Reply
ole
Posts: 4
Joined: Mon Dec 03, 2012 11:55 am

How to create an FTPS connection

Post by ole » Mon Dec 03, 2012 12:08 pm

Hello

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
Ole

mb
Posts: 12030
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: How to create an FTPS connection

Post by mb » Mon Dec 03, 2012 12:24 pm

What language do you use? C#?

ole
Posts: 4
Joined: Mon Dec 03, 2012 11:55 am

Re: How to create an FTPS connection

Post by ole » Mon Dec 03, 2012 12:25 pm

C#, yes

vb.net could also do for examples

mb
Posts: 12030
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: How to create an FTPS connection

Post by mb » Mon Dec 03, 2012 3:38 pm

Please install the latest version of the ftp library:
https://www.smartftp.com/ftplib/download

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

ole
Posts: 4
Joined: Mon Dec 03, 2012 11:55 am

Re: How to create an FTPS connection

Post by ole » Tue Dec 04, 2012 7:54 am

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);

mb
Posts: 12030
Joined: Thu Oct 11, 2001 1:24 pm
Display name: Mat (SmartFTP)
Contact:

Re: How to create an FTPS connection

Post by mb » Tue Dec 04, 2012 9:17 am

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++.
Last edited by mb on Tue Dec 04, 2012 11:11 am, edited 1 time in total.

Post Reply