go – GoLang : "No common algorithm for key exchange" error-ThrowExceptions

Exception or error:

I am new to GoLang and I am trying to connect to a remote server using go. But I keep getting the following error

Failed to dial: ssh: handshake failed: ssh: no common algorithm for key exchange; client offered: [curve2****-sh****@libssh.org ****-sha*-nis****ecdh-sha2-nistp384 ecdh-sha2-nistp**** diffie-hellman-group14-sha1 diffie-hellman-group1-sha1], server offered: [diffie-hellman-group-exchange-sha***]

below is the config that I use to connect

 config := &ssh.ClientConfig{

    User: user,

    HostKeyCallback: nil,

    Auth: []ssh.AuthMethod{

    publicKey,
    },
}
How to solve:

Well, like the error says, the client and the server don’t have any algorithms they’re willing to agree on, so they can’t talk. The six that Go is offering are all the ones it supports (out of the 12 that openssh does); the server is only offering one that isn’t any of those. Your options:

  1. Convince the server to accept more KEX algorithms; it’s possible that it supports more, and someone just configured it super restrictively.
  2. Implement DH Group Exchange for x/crypto/ssh yourself, and send the patch upstream.
  3. Find a different client.

Answer´╝Ü

take a look at this question

I’m still working on that but VonC put some interesting tips in order to resolve it.

hope it helps.

Leave a Reply

Your email address will not be published. Required fields are marked *