0 votes
by (120 points)
edited by

I'm having trouble connecting to a SFTP server using Rebex.Sftp R5.1 for .NET 4.0-4.8. The sample SFTP client app throws an error.

I've tried adding the settings below to the code but it also doesn't work.
Settings.SshParameters.PreferredHostKeyAlgorithm = SshHostKeyAlgorithm.RSA;
Settings.SshParameters.UseLegacyGroupExchange = false;

Also I have no issue connecting using FileZilla or SecureBlackbox SFTP component. How can I resolve this issue?

2021-04-05 13:28:17.659 Opening log file.
2021-04-05 13:28:17.670 INFO FileLogWriter(1)[1] Info: Assembly: Rebex.Common R5.1 for .NET 4.0-4.8
2021-04-05 13:28:17.676 INFO FileLogWriter(1)[1] Info: Platform: Windows 6.1.7601 64-bit; CLR: 4.0.30319.42000
2021-04-05 13:28:17.678 DEBUG FileLogWriter(1)[1] Info: Culture: en; Windows-1252
2021-04-05 13:28:20.119 INFO Sftp(1)[1] Info: Connecting to ftp1.thevillageshealth.com:22 using Sftp.
2021-04-05 13:28:20.120 INFO Sftp(1)[1] Info: Assembly: Rebex.Sftp R5.1 for .NET 4.0-4.8
2021-04-05 13:28:20.120 INFO Sftp(1)[1] Info: Platform: Windows 6.1.7601 64-bit; CLR: 4.0.30319.42000
2021-04-05 13:28:20.120 DEBUG Sftp(1)[1] Info: Culture: en; Windows-1252
2021-04-05 13:28:20.146 DEBUG Sftp(1)[1] Proxy: Resolving 'ftp1.thevillageshealth.com'.
2021-04-05 13:28:20.221 DEBUG Sftp(1)[1] Proxy: Connecting to 130.44.218.11:22 (no proxy).
2021-04-05 13:28:20.237 DEBUG Sftp(1)[1] Proxy: Connection established.
2021-04-05 13:28:20.268 DEBUG Sftp(1)[1] SSH: Server is 'SSH-2.0-SyncplifyMeServer'.
2021-04-05 13:28:20.284 INFO Sftp(1)[1] SSH: Negotiation started.
2021-04-05 13:28:20.598 DEBUG Sftp(1)[1] SSH: Group exchange.
2021-04-05 13:28:20.611 DEBUG Sftp(1)[1] SSH: Negotiating key.
2021-04-05 13:28:20.687 DEBUG Sftp(1)[1] SSH: Received 2048-bit Diffie-Hellman prime (minimum allowed size is 1024 bits).
2021-04-05 13:28:20.854 DEBUG Sftp(1)[1] SSH: Validating signature.
2021-04-05 13:28:20.985 ERROR Sftp(1)[1] SSH: Negotiation failed. Server signature is not valid.
2021-04-05 13:28:20.996 ERROR Sftp(1)[1] Info: Rebex.Net.SshException: Server signature is not valid.
at zoqqa.xwoym.wgusq(SshSession p0, Byte[] p1, Byte[] p2, Byte[] p3, Byte[] p4, jqdoi& p5, Byte[]& p6, SshPublicKey& p7)
at Rebex.Net.SshSession.xzeya(Byte[] p0)
at Rebex.Net.SshSession.Negotiate()
at Rebex.Net.Sftp.zoqqa.drouv.wfhks(julqx p0, Boolean p1)
at Rebex.Net.Sftp.giguj(String p0, Int32 p1, SshParameters p2, julqx p3)

Applies to: Rebex SFTP

1 Answer

0 votes
by (144k points)
Would it be possible to create a log at LogLevel.Verbose level and post that as well for analysis?

Additionally, please try forcing the classic “ssh-rsa” host key algorithm. Otherwise, Rebex SFTP would use “rsa-sha2-256” or “rsa-sha2-512”, which are wrongly implemented by some servers (and not supported by FileZilla yet).
 
client.Settings.SshParameters.SetHostKeyAlgorithms("ssh-rsa");
by (120 points)
Adding the following lines of code resolved the issue for my case.

client.Settings.SshParameters.SetHostKeyAlgorithms("ecdsa-sha2-nistp521");
                    client.Settings.SshParameters.HostKeyAlgorithms = SshHostKeyAlgorithm.ECDsaNistP521;
                    client.Settings.SshParameters.KeyExchangeAlgorithms = SshKeyExchangeAlgorithm.ECDiffieHellmanNistP256;
...