libssh2 / libssh2

the SSH library

Home Page:https://libssh2.org/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

libssh2_session_handshake LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE

PengShiJin opened this issue · comments

I'm running libssh2 on an ARM development board and I'm having a problem with not being able to exchange keys. But I can't find a solution. When calling the "libssh2_session_handshake" function it keeps returning -8. Can anyone tell me how to solve this problem, thanks a lot!
image
image

Which libssh2 version and crypto-backend/version is this happening with?

Which libssh2 version and crypto-backend/version is this happening with?

This is the version of the target host.
image

Versions I compiled: libssh2-1.11.0 and openssl1.1.1d

After I created the rsa key pair using ssh-keygen. The default address where the key pair is saved is "/root/.ssh/" I don't know if this has any effect. Then I gave the key pair "777" permissions. But it still doesn't work.
image

Can anyone help me with why this is happening?

i'm getting the same failure #1369 (comment)

i'm getting the same failure #1369 (comment)

I've tried using versions 1.8.0 through 1.11.0, and they all fail without exception. However, when I use the lower versions I no longer get "key exchange failed" errors, but "free" and "malloc" errors. I don't understand why this is happening.

i have the same problem in windows when libssh2_session_handshake excute.The version is 1.11.0. I dont understand Why.

Just putting this out here: I had a similar issue in version 1.11.0 on Windows, using the WINCNG backend.

The debug trace showed:

Key Ex: Agreed on KEX method: diffie-hellman-group-exchange-sha256
...
Failure Event: -5 - dh key pair generation failed
Failure Event: -8 - Unrecoverable error exchanging keys
Failure Event: -8 - Unable to exchange encryption keys

My workaround is avoiding deffie-hellman-group-exchange-sha256, either by selecting a different preferred method with libssh2_session_method_pref or by adding KexAlgorithms -diffie-hellman-group-exchange-sha256 to sshd_config.