Skip to content

libssh2_session_handshake LIBSSH2_ERROR_KEY_EXCHANGE_FAILURE #1370

Open

Description

@PengShiJin

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

Activity

  1. vszakats commented on Apr 16, 2024

    @vszakats
    Member

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

  2. PengShiJin commented on Apr 17, 2024

    @PengShiJin
    Author

    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?

  3. victorstewart commented on Apr 19, 2024

    @victorstewart

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

  4. PengShiJin commented on Apr 20, 2024

    @PengShiJin
    Author

    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.

  5. YiShuiHanFeng commented on May 16, 2024

    @YiShuiHanFeng

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

  6. logmanoriginal commented on Jun 1, 2024

    @logmanoriginal
    Contributor

    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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions