Skip to content

Key Exchange Negotiation Failed #858

Closed

Description

@LoneWolfPlanet

Hello sirs.
I have verified both supported Key Exchange Methods in the server and client using "ssh -Q kex" command
and found that they the same methods .
But still I'm encountering the issue below.

Code
using(SftpClient client = new SftpClient( "hostname", "username" , "password")){
client.Connect();
}

Stack Trace
Key exchange negotiation failed.
at Renci.SshNet.Security.KeyExchange.Finish() + 0x71
at Renci.SshNet.Security.KeyExchangeECCurve25519.Finish() + 0xe
at Renci.SshNet.Security.KeyExchangeECCurve25519.Session_KeyExchangeEcdhReplyMessageReceived(Object, MessageEventArgs`1) + 0x3f
at Renci.SshNet.Session.OnKeyExchangeEcdhReplyMessageReceived(KeyExchangeEcdhReplyMessage) + 0x60
at Renci.SshNet.Messages.Transport.KeyExchangeEcdhReplyMessage.Process(Session) + 0x14
at Renci.SshNet.Session.MessageListener() + 0x53
at Renci.SshNet.Session.WaitOnHandle(WaitHandle, TimeSpan) + 0x100
at Renci.SshNet.Session.WaitOnHandle(WaitHandle) + 0x16
at Renci.SshNet.Session.Connect() + 0x2d7
at Renci.SshNet.BaseClient.CreateAndConnectSession() + 0x12c
at Renci.SshNet.BaseClient.Connect() + 0x9b

Activity

  1. IgorMilavec commented on Aug 18, 2021

    @IgorMilavec
    Collaborator

    Can you try to disable ECC25519 to see if it is able to verify using other methods?

    ConnectionInfo connectionInfo = new ConnectionInfo(
        host,
        port,
        userName,
        authenticationMethods);
    
    connectionInfo.KeyExchangeAlgorithms.Remove("curve25519-sha256");
    connectionInfo.KeyExchangeAlgorithms.Remove("curve25519-sha256@libssh.org");
    
    SftpClient client = new SftpClient(connectionInfo)
  2. ckorn commented on Aug 4, 2022

    @ckorn

    I deleted my comments because my issue was just a wrong host key fingerprint.

  3. added this to the 2023.0.0 milestone on Sep 18, 2023
  4. WojciechNagorski commented on Sep 23, 2023

    @WojciechNagorski
    Collaborator

    Fixed by #1177 and #1180

  5. WojciechNagorski commented on Oct 10, 2023

    @WojciechNagorski
    Collaborator

    Version 2023.0.0 has been published https://www.nuget.org/packages/SSH.NET/2023.0.0

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

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions