+1 vote

Hi We get this exception "A call to SSPI failed, see inner exception." when we try to connect. It's thrown from ConnectSSL method (SslStream.AuthenticateAsClient).

The inner exception is "The message received was unexpected or badly formatted"

Our code is really simple:

using (Ftp client = new Ftp())
{               
    client.ConnectSSL("ftp.XXX.com");

    client.Close();
}

We are able to connect using FileZilla. What does this exception mean?

by
edited by

1 Answer

0 votes
 
Best answer

Most likely your server needs TLS 1.2 to secure the channel, while your OS tries to use older protocol like SSL3.

You can force which protocol you want to use by setting client.SSLConfiguration.EnabledSslProtocols property:

using (Ftp client = new Ftp())
{
    client.SSLConfiguration.EnabledSslProtocols = SslProtocols.Tls12;

    client.ConnectSSL("ftp.XXX.com");

    client.Close();
}

Please note that TLS 1.2 is not supported on Windows XP. You may try to use TLS 1.1, but you should rather consider upgrading your OS.

by (301k points)
...