EldoS | Feel safer!

Software components for data protection, secure storage and transfer

SFTP .NET 4.5 - Connection failed (error code is 2)

Also by EldoS: MsgConnect
Cross-platform protocol-independent communication framework for building peer-to-peer and client-server applications and middleware components.
Posted: 08/20/2013 00:29:51
by Brett Beattie (Standard support level)
Joined: 03/08/2011
Posts: 25

We have recently upgraded a number of components to .NET 4.5

We have found that some particular SFTP Servers give the following error when we build an SFTP Client as .NET 4.5
"Connection failed (error code is 2)"

This happens with SB versions 8.2.196, 10.0.232, 10.0.233 and the current beta If we build the client as .Net4.0 or .Net3.5 it works fine.

We have the 3 hotfixes mentioned previously installed.

I have built and run the sample client (SimpleSftpDemo_VS2012.csproj) and get the same error when connecting. The client receives the server key but then fails without attempting to authenticate.

The ServerSoftwareName value on both the servers that cause the error for us is "SSHD" - I assume it is the same server software on both. I do not have control of those servers to be able to check any details.

I can provide the address of one of these public servers outside the forum if you want to test.

As mentioned it works with other .Net builds, they also work fine with the CoreFTP Lite client.
Posted: 08/20/2013 00:36:25
by Eugene Mayevski (EldoS Corp.)

Thank you for the report. Indeed we need to reproduce the problem and this can only be done when we have access to the server. I've moved the ticket to the helpdesk where we can get the connection details and try to reproduce the problem.

Sincerely yours
Eugene Mayevski
Posted: 08/20/2013 11:10:49
by Eugene Mayevski (EldoS Corp.)

JFI: Disabling 3DES (it's a good idea to disable it anyway due to its slowness) solves the problem.

SftpClient.set_EncryptionAlgorithms(SBSSHConstants.Unit.SSH_EA_3DES, false);
Posted: 08/20/2013 16:29:49
by Brett Beattie (Standard support level)
Joined: 03/08/2011
Posts: 25

Ahh that is fantastic! Thanks heaps for that.

(Committed to a release in the next few weeks and found this problem late in testing!)

Very happy.
Posted: 08/20/2013 16:33:46
by Eugene Mayevski (EldoS Corp.)

FWIW: that the server's bug (maybe in configuration rather than in code, I can't say) -- it declares support for 3DES algorithm in client-to-server communication, but not for server-to-client one, and even then the server fails to provide claimed support for 3DES.

And the interesting part was that .NET 4.5 uses another sorting algorithm which brought 3DES as an option when negotiating algorithms. Before .NET 4.5 used sorting algorithms choose AES as preferred. So it was not exactly .NET 4.5 bug but an interesting combination of factors.

Sincerely yours
Eugene Mayevski
Also by EldoS: CallbackDisk
Create virtual disks backed by memory or custom location, expose disk images as disks and more.



Topic viewed 1830 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!