Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Key Exchange Negotiation Failed #858

Closed
LoneWolfPlanet opened this issue Aug 9, 2021 · 4 comments
Closed

Key Exchange Negotiation Failed #858

LoneWolfPlanet opened this issue Aug 9, 2021 · 4 comments
Milestone

Comments

@LoneWolfPlanet
Copy link

LoneWolfPlanet commented Aug 9, 2021

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

@IgorMilavec
Copy link
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)

@ckorn
Copy link

ckorn commented Aug 4, 2022

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

@WojciechNagorski
Copy link
Collaborator

Fixed by #1177 and #1180

@WojciechNagorski
Copy link
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
Projects
None yet
Development

No branches or pull requests

4 participants