SFTP connection fails - Negotiation failed. The client and the server have no common key exchange algorithm

0 votes
asked May 25 by Chicago123 (120 points)

The full error message is:
Negotiation failed. The client and the server have no common key exchange algorithm. Server supports 'diffie-hellman-group1-sha1' which is weak and not enabled at the client.

How do I enable 'diffie-hellman-group1-sha1' ?

Applies to: Rebex SFTP

1 Answer

0 votes
answered May 26 by Lukas Pokorny (85,050 points)

This legacy algorithm can be enabled using Sftp object's Settings.SshParameters.KeyExchangeAlgorithms property:

var client = new Sftp();
client.Settings.SshParameters.KeyExchangeAlgorithms |= SshKeyExchangeAlgorithm.DiffieHellmanGroup1SHA1;
client.Connect(serverName);
...

For additional information, see SSH ciphers and Setting connection options.

Also, please be aware that the diffie-hellman-group1-sha1 cipher is not secure.

...