1

I try to establish a FTPS connection (explicit). On Windows 10, my program works fine, but on Windows 7 I have an error. I use the FluentFTP library in C#.

I have already tried to change the SslProtocols with Tls,Tls11,Tls12, but it doesn't work.

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

Here is my 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()

Thank's for helps.

Bastien Cuenot
  • 117
  • 1
  • 1
  • 9
  • Windows 7 required an update to enable TLS 1.1/2 - If the system is fully patched then you need a registry change to enable those versions: [Microsoft FixIt](https://support.microsoft.com/en-us/help/3140245/update-to-enable-tls-1-1-and-tls-1-2-as-default-secure-protocols-in-wi#easy) - This page also links to the specific patch if the system is not upto date. – Alex K. Jul 04 '19 at 13:05

0 Answers0