0 votes
by (160 points)

Hi, I am using below code to transfer file to mainframe server

Ftp fClient = new Ftp();

        try
        {
            //ftp over ssl -> secure ftp protocol for mainframe
            fClient.Settings.SslAcceptAllCertificates = true;
            fClient.Connect(ftpServerName, SslMode.Explicit);
            fClient.Login(ftpUserName, ftpPassword);
            fClient.TransferType = FtpTransferType.Ascii;
            fClient.Site("RECFM=FB LRECL=100 BLOCKSIZE=0");

            fClient.PutFile(sourceFilePath, ftpFilePath);
        }

It seems it is using TLS 1.0 to connect and it is failing to connect to server because now server is enforcing TLS 1.2.

How can I modify the code to use TLS 1.2 for connection?

Applies to: Rebex FTP/SSL

1 Answer

0 votes
by (73.6k points)

TLS 1.2 is enabled by default and it should be negotiated as the first possible choice. You can ensure that TLS 1.2 is enabled like this:

fClient.Settings.SslAllowedVersions = TlsVersion.TLS12;

However, I think the problem is probably caused by something else. Please, create the communication log and post it here or send it to support@rebex.net for analysis. It can be created like this:

fClient.LogWriter = new Rebex.FileLogWriter(@"c:\data\ftp.log", Rebex.LogLevel.Debug);
by (160 points)
Hi, I tried using fClient.Settings.SslAllowedVersions = TlsVersion.TLS12;
But it is giving error in TLS12. it is only showing TLS10 and TLS11. There is no option to select TLS12.
by (160 points)
Rebex dlls that we are using are of version "3.0.4700.0".
by (73.6k points)
Oh, it explains everything. Version 3.0.4700.0 is from 2012. We added support for TLS 1.2 in 2015 (see https://www.rebex.net/total-pack/history.aspx#5555).

Please, try the latest version. You can download free trial from https://www.rebex.net/total-pack/download.aspx
...