# Usage of the SSLFTPSSLVersion.DETECT Enumeration

26 views
asked Mar 6 in .NET FTP

The documentation on the SSLFTPSSLVersion enumeration states that DETECT will "detect if the server requests TLS1.0 or TLS 1.1" (as found here:  https://enterprisedt.com/products/edtftpnetpro/doc/manual/api/html/T_EnterpriseDT_Net_Ftp_Ssl_SSLFTPSSLVersion.htm).  Now that version 9.0+ also supports TLS 1.2, will DETECT work for sites that require TLS 1.2?

The reason I ask is because I connect to different sites that have various levels of TLS compatibility (some require TLS 1.0, while others will soon require TLS 1.2).  I'd like to be able to set the version to DETECT and let the library do the work of figuring out which one is required.

As a secondary question, is there a way to determine which TLS version is used on an open connection?  For example, is there a property that I can write to the logs to indicate the TLS version used?

My implementation uses SSLFTPClient.

Here is some sample code that I'm using:

SSLFTPClient FTPS = new SSLFTPClient
{
IsImplicitFTPS = false,
ServerValidation = SecureFTPServerValidationType.None
};

var client = SSLFTPCertificate.CreateFromPFX(@"C:\path\to\my\file.pfx", "myCertPassword", true);
FTPS.ClientCertificate = client;
FTPS.Connect();
FTPS.Auth(SSLFTPSSLVersion.DETECT, true);
//Log TLS version here