0 votes

The 3rd-party server we are connecting is now upgrading to TLS 1.2 protocol.
I change our validation code to the following:

// open ftp session
using (Ftp client = new Ftp())
{
    client.SSLConfiguration.EnabledSslProtocols = SslProtocols.Tls12;

    // connect to sftp server
    client.ConnectSSL(FtpSite, FtpPort);

    // login with user name & password
    client. Login(FtpUserName, FtpPassword);

    // does document folder exist?
    bool isDocumentFolder = client.FolderExists(FtpDocumentFolder);

    // does acknowledgement folder exist?
    bool isAcknowledgementFolder = client.FolderExists(FtpAcknowledgementFolder);

    client. Close();
}

FtpPort = 22. I'm getting following exception throw by this code:

Testing FTP Server Failed. Authenticate as SSL/TLS client failed.
You might be connecting to non SSL/TLS port -or- using incorrect SSL/TLS version.
Consider using TLS 1.2: client.SSLConfiguration.EnabledSslProtocols = SslProtocols.Tls12;

What am I missing? Is there any way to determine why the connection is failing?

Thanks,
Gary.

by (200 points)

1 Answer

0 votes

Port 22 is not a valid port for FTPS.
Don't specific it, Ftp.dll will use the correct default one.

by (301k points)

Removed setting port and it worked. Thanks.

:( Turns out I tested the wrong system.

When I specify the port = 22, which is the port configured by 3rd-party, I get the error:
Testing FTP Server Failed. Authenticate as SSL/TLS client failed.
You might be connecting to non SSL/TLS port -or- using incorrect SSL/TLS version.
Consider using TLS 1.2: client.SSLConfiguration.EnabledSslProtocols = SslProtocols.Tls12;

(as stated in original post)

However, if I don't specify the port (ie. client.ConnectSSL(FtpSite)), I get the error:
A connection attempt failed because the connected party did not properly respond after a period of time, or established connection failed because connected host has failed to respond xxx.xx.xx.xxx:990

By default, it appears to try to connect to port 990. I need it to connect to port 22. I have verified with Windows SFTP.exe that I can indeed connect to remote site on port 22.

Thanks,
Gary.

Port 22 is for SFTP it's a different protocol. Ftp.dll is for FTP and FTPS.

Hmm, didn't realize there was a difference between SFTP and FTPS.
After reviewing, now I can see why it's not working, wrong protocol.

I'm assuming my only options are either get 3rd-party vendor to implement FTPS or find another .Net library that supports SFTP.

Do you have any plans of supporting the SFTP protocol?

Thanks,
Gary.

No, Ftp.dll supports FTP and FTPS only.

...