FluentFTP icon indicating copy to clipboard operation
FluentFTP copied to clipboard

Connection error - FTPS Windows 7

Open BastienCUENOT opened this issue 6 years ago • 1 comments

FTP OS: Windows

FTP Server: VsFTPd

Computer OS: Windows 7

I try to establish a FTPS connection (explicit). On Windows 10, my program works fine, but on Windows 7 I have an error. I have already tried to change the SslProtocols with Tls,Tls11,Tls12, but it doesn't work. My code:

FtpClient client = new FtpClient("192.168.5.22","supervisor", "supervisor");
    // Options de session de session 
    client.EncryptionMode = FtpEncryptionMode.Explicit;
    client.SslProtocols = SslProtocols.Tls |SslProtocols.Tls11 | SslProtocols.Tls12;
    client.ValidateCertificate += new FtpSslValidation(OnValidateCertificate);
    client.Connect();

    //.....
    //My OnValidateCertificate function
    void OnValidateCertificate(FtpClient control, FtpSslValidationEventArgs e) {
            // add logic to test if certificate is valid here
            e.Accept = true;
    }

And I have this error:

System.Security.Authentication.AuthenticationException: A call to SSPI failed, see inner exception. ---> System.ComponentModel.Win32Exception: The message received was unexpected or badly formatted --- End of inner exception stack trace --- at System.Net.Security.SslState.StartSendAuthResetSignal(ProtocolToken message, AsyncProtocolRequest asyncRequest, Exception exception) at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ProcessReceivedBlob(Byte[] buffer, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartReceiveBlob(Byte[] buffer, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.StartSendBlob(Byte[] incoming, Int32 count, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ForceAuthentication(Boolean receiveFirst, Byte[] buffer, AsyncProtocolRequest asyncRequest) at System.Net.Security.SslState.ProcessAuthentication(LazyAsyncResult lazyResult) at FluentFTP.FtpSocketStream.ActivateEncryption(String targethost, X509CertificateCollection clientCerts, SslProtocols sslProtocols) at FluentFTP.FtpClient.Connect()

Logs :


# Connect()
Status:   Connecting to ***:21
Response: 220 (vsFTPd 3.0.3)
Status:   Detected FTP server: VsFTPd
Command:  AUTH TLS
Response: 234 Proceed with negotiation.
Status:   Disposing FtpSocketStream...
Error:    FTPS Authentication Failed

# Dispose()
Status:   Disposing FtpClient object...
Status:   Disposing FtpSocketStream...

BastienCUENOT avatar Jul 05 '19 08:07 BastienCUENOT

Can confirm I am having a similar problem as well. Confirmed TLS 1.2 is enabled on the windows 7 machine

Used with and without: client.SslProtocols = SslProtocols.Tls |SslProtocols.Tls11 | SslProtocols.Tls12;

Went through .net 4.6, 4.7 and 4.8. They're all giving the same issues.

MrArca9 avatar Jun 25 '20 01:06 MrArca9