Rebex.Net.SftpException: Key exchange failed. Requested service is not implemented

+1 vote
asked Jul 12, 2016 by Ritesh (350 points)

I am not able to connect to the SFTP server. I am getting the error messages as "Rebex.Net.SftpException: Key exchange failed. Requested service is not implemented. ---> Rebex.Net.SshException: Key exchange failed. Requested service is not implemented."

But when I connect using the FileZilla FTP client it works fine. Could you please help me out on this.

Many Thanks

Applies to: Rebex SFTP

1 Answer

0 votes
answered Jul 12, 2016 by Lukas Matyska (56,090 points)
edited May 20, 2019 by Lukas Pokorny

The error is most likely caused by a mismatch between the form of Diffie-Hellman group exchange used by the client and the server. The old Rebex client uses the legacy form that was prevalent in early days of the SSH protocol (even as late as 2010, legacy form was the only form supported by some servers), but the server you are connecting to insists on using the standard form which is prevalent now. Historically, many servers supported both forms, but it looks like some SSH servers have recently started rejecting clients using the legacy form.

Possible solutions:

  1. Set Sftp object's Settings.SshParameters.UseLegacyGroupExchange property to false (only available in Rebex SFTP 2017 R6.2 and later).

  2. Upgrade to a recent version of Rebex SFTP. To make sure it resolves the issue, try the free 30-day trial first.

commented Jul 12, 2016 by Ritesh (350 points)
Yes, I am using SFTP protocol with FileZilla. The rebex SFTP protocol was working fine till couple of days back. All of sudden I am getting the message "Rebex.Net.SshException: Key exchange failed. Requested service is not implemented."

I am using the following code and it has been working fine till two days back.

 Dim SFTPclient As New Sftp()
            If Not SFTPclient.State = SftpState.Connected Then
                SFTPclient.Connect(ConfigurationManager.AppSettings("Host"))
                SFTPclient.Login(ConfigurationManager.AppSettings("Username"), ConfigurationManager.AppSettings("Password"))
                SFTPclient.GetFiles(ConfigurationManager.AppSettings("RemotePath"), ConfigurationManager.AppSettings("LocalDirPath"), SftpBatchTransferOptions.Default, SftpActionOnExistingFiles.SkipAll)
            End If
commented Jul 12, 2016 by Lukas Matyska (56,090 points)
Can you please send us log of the communication of both Rebex and FileZilla? We will compare it and let you know what to do.

Using Rebex, the log can be created like this:

    Dim SFTPclient As New Sftp()
    SFTPclient.LogWriter = New Rebex.FileLogWriter("c:\logs\sftp.txt", Rebex.LogLevel.Debug)
commented Jul 12, 2016 by Ritesh (350 points)
Please see below the log

2016-07-12 15:58:29.506 Opening log file.
2016-07-12 15:58:32.681 INFO Sftp(1) Info: Connecting to test.test.co.uk:22 using Sftp 2.0.3854.0.
2016-07-12 15:58:34.032 DEBUG Sftp(1) SSH: Server is 'SSH-2.0-OpenSSH_7.2p2 Ubuntu-4ubuntu1'.
2016-07-12 15:58:34.137 DEBUG Sftp(1) SSH: Negotiation started.
2016-07-12 15:58:34.775 DEBUG Sftp(1) SSH: Group exchange.
2016-07-12 15:58:35.055 DEBUG Sftp(1) SSH: Negotiation failed: Rebex.Net.SshException: Key exchange failed. Requested service is not implemented. ---> Rebex.Net.SshException: Requested service is not implemented.
   at Rebex.Net.SshSession.cqLugQ(Byte[] , Int32 , Int32 )
   at Rebex.Net.SshSession.AapcLiZ(Byte[] , Int32 , Int32 )
   at Rebex.Net.SshSession.cDtmAOZ(Int64& , Boolean )
   at Rebex.Net.SshSession.CFLiXJ(ANiLIV )
   at wWGvS.CLJmsVZ.ArwjUr(SshSession , Byte[] , Byte[] , Byte[] , Byte[] , Byte[]& , Byte[]& , Byte[]& )
   at Rebex.Net.SshSession.ArwjUr(Byte[] )
   --- End of inner exception stack trace ---
   at Rebex.Net.SshSession.ArwjUr(Byte[] )
2016-07-12 15:58:35.066 ERROR Sftp(1) SSH: Rebex.Net.SshException: Key exchange failed. Requested service is not implemented. ---> Rebex.Net.SshException: Requested service is not implemented.
   at Rebex.Net.SshSession.cqLugQ(Byte[] , Int32 , Int32 )
   at Rebex.Net.SshSession.AapcLiZ(Byte[] , Int32 , Int32 )
   at Rebex.Net.SshSession.cDtmAOZ(Int64& , Boolean )
   at Rebex.Net.SshSession.CFLiXJ(ANiLIV )
   at wWGvS.CLJmsVZ.ArwjUr(SshSession , Byte[] , Byte[] , Byte[] , Byte[] , Byte[]& , Byte[]& , Byte[]& )
   at Rebex.Net.SshSession.ArwjUr(Byte[] )
   --- End of inner exception stack trace ---
   at Rebex.Net.SshSession.ArwjUr(Byte[] )
   at Rebex.Net.SshSession.bOtYJuZ()
   at Rebex.Net.SshSession.Negotiate()
2016-07-12 15:58:35.074 ERROR Sftp(1) Info: Rebex.Net.SshException: Key exchange failed. Requested service is not implemented. ---> Rebex.Net.SshException: Requested service is not implemented.
   at Rebex.Net.SshSession.cqLugQ(Byte[] , Int32 , Int32 )
   at Rebex.Net.SshSession.AapcLiZ(Byte[] , Int32 , Int32 )
   at Rebex.Net.SshSession.cDtmAOZ(Int64& , Boolean )
   at Rebex.Net.SshSession.CFLiXJ(ANiLIV )
   at wWGvS.CLJmsVZ.ArwjUr(SshSession , Byte[] , Byte[] , Byte[] , Byte[] , Byte[]& , Byte[]& , Byte[]& )
   at Rebex.Net.SshSession.ArwjUr(Byte[] )
   --- End of inner exception stack trace ---
   at Rebex.Net.SshSession.ArwjUr(Byte[] )
   at Rebex.Net.SshSession.bOtYJuZ()
   at Rebex.Net.SshSession.Negotiate()
   at Rebex.Net.Sftp.Connect(String serverName, Int32 serverPort, SshParameters parameters)






FileZilla Client

Status:    Connecting to test.test.co.uk...
Response:    fzSftp started
Command:    open "test@test.test.co.uk" 22
Command:    Trust new Hostkey: Once
Command:    Pass: ********
Status:    Connected to test.test.co.uk
Status:    Retrieving directory listing...
Command:    pwd
Response:    Current directory is: "/"
Command:    ls
Status:    Listing directory /
Status:    Calculating timezone offset of server...
Command:    mtime "test.csv"
Response:    1462075500
Status:    Timezone offsets: Server: -3600 seconds. Local: 0 seconds. Difference: 3600 seconds.
Status:    Directory listing successful
commented Jul 12, 2016 by Lukas Pokorny (107,310 points)
You are using Rebex SFTP 2.0.3854.0, which is 6 years old. Can you please try connecting with the current version? You can download the trial  from http://www.rebex.net/sftp.net/download.aspx and try connecting using its SftpWinFormClient sample.
commented Jul 13, 2016 by Ritesh (350 points)
Thanks for your help. the new component is working fine!. I have another question

I have created a folder called ABC In my local disk where I want all the files to be downloaded so for example C:\ABC. In my root folder of the FTP server I have sub folder
called xyz where all the files have been stored. so when I am running the program the files are getting downloaded in C:\ABC\XYZ but I don't want like that I want them to be downloaded in C:\ABC folder only
Is there any way we can achieve this?

Many Thanks
commented Jul 13, 2016 by Ritesh (350 points)
I think I have got that. Thanks for all your help.
commented Jul 13, 2016 by Lukas Matyska (56,090 points)
Yes, append asterisk '*' to the source path, like this ftp.Download("/XYZ/*", "C:/ABC").
commented Oct 5, 2017 by mike_saroyan (100 points)
I am having this identical issue with a connection that had been working for over three years without a glitch. When I use FileZilla or WinSCP with SFTP option, I am able to connect, but with Rebex, I get the error message "Key exchange failed. Requested service is not implemented". I am using Rebex version 3.0.4700. Below is the log entry:
2017-10-05 12:25:51.647 Opening log file.
2017-10-05 12:25:53.690 INFO Sftp(1)[10] Info: Connecting to clientXYZ.com:22 using Sftp 3.0.4700.0.
2017-10-05 12:25:53.831 DEBUG Sftp(1)[10] SSH: Server is 'SSH-2.0-OpenSSH_7.4'.
2017-10-05 12:25:53.831 INFO Sftp(1)[10] SSH: Negotiation started.
2017-10-05 12:25:53.924 DEBUG Sftp(1)[10] SSH: Group exchange.
2017-10-05 12:25:54.080 DEBUG Sftp(1)[10] SSH: Negotiation failed: Rebex.Net.SshException: Key exchange failed. Requested service is not implemented. ---> Rebex.Net.SshException: Requested service is not implemented.
   at Rebex.Net.SshSession.1xzy5U(Byte[] , Int32 , Int32 )
   at Rebex.Net.SshSession.i12XcZ(Byte[] , Int32 , Int32 )
   at Rebex.Net.SshSession.1rsOcLZ(1VEj6UZ , Object[] )
   at Rebex.Net.SshSession.2aErfC(OCfHX )
   at gbMKS.2dBnlEZ.qzm1d(SshSession , Byte[] , Byte[] , Byte[] , Byte[] , Byte[]& , Byte[]& , SshPublicKey& )
   at Rebex.Net.SshSession.qzm1d(Byte[] )
   --- End of inner exception stack trace ---
   at Rebex.Net.SshSession.qzm1d(Byte[] )
2017-10-05 12:25:54.111 ERROR Sftp(1)[10] SSH: Rebex.Net.SshException: Key exchange failed. Requested service is not implemented. ---> Rebex.Net.SshException: Requested service is not implemented.
   at Rebex.Net.SshSession.1xzy5U(Byte[] , Int32 , Int32 )
   at Rebex.Net.SshSession.i12XcZ(Byte[] , Int32 , Int32 )
   at Rebex.Net.SshSession.1rsOcLZ(1VEj6UZ , Object[] )
   at Rebex.Net.SshSession.2aErfC(OCfHX )
   at gbMKS.2dBnlEZ.qzm1d(SshSession , Byte[] , Byte[] , Byte[] , Byte[] , Byte[]& , Byte[]& , SshPublicKey& )
   at Rebex.Net.SshSession.qzm1d(Byte[] )
   --- End of inner exception stack trace ---
   at Rebex.Net.SshSession.qzm1d(Byte[] )
   at Rebex.Net.SshSession.14Ad4fZ()
   at Rebex.Net.SshSession.Negotiate()
2017-10-05 12:25:54.143 ERROR Sftp(1)[10] Info: Rebex.Net.SshException: Key exchange failed. Requested service is not implemented. ---> Rebex.Net.SshException: Requested service is not implemented.
   at Rebex.Net.SshSession.1xzy5U(Byte[] , Int32 , Int32 )
   at Rebex.Net.SshSession.i12XcZ(Byte[] , Int32 , Int32 )
   at Rebex.Net.SshSession.1rsOcLZ(1VEj6UZ , Object[] )
   at Rebex.Net.SshSession.2aErfC(OCfHX )
   at gbMKS.2dBnlEZ.qzm1d(SshSession , Byte[] , Byte[] , Byte[] , Byte[] , Byte[]& , Byte[]& , SshPublicKey& )
   at Rebex.Net.SshSession.qzm1d(Byte[] )
   --- End of inner exception stack trace ---
   at Rebex.Net.SshSession.qzm1d(Byte[] )
   at Rebex.Net.SshSession.14Ad4fZ()
   at Rebex.Net.SshSession.Negotiate()
   at Rebex.Net.Sftp.1J4sBU.qzm1d(ZD5WJ )
   at Rebex.Net.Sftp.2eOMSNZ(String , Int32 , SshParameters , ZD5WJ )
2017-10-05 12:26:10.304 ERROR Sftp(1)[10] Info: System.InvalidOperationException: Not authenticated to the server.
   at Rebex.Net.Sftp.Qv0o9Z()
   at Rebex.Net.Sftp.TZuYIZ(Qu2Ci , ZD5WJ , String , Stream , Int64 , Int64 , 27NpLhZ )
commented Oct 6, 2017 by stepantalalayev (3,940 points)
You are using Rebex SFTP Version 2012 R3 , which is 5 years old. Can you please try connecting with the current version? You can download the trial  from http://www.rebex.net/sftp.net/download.aspx and try connecting using its SftpWinFormClient sample.
commented Jun 13, 2018 by malhameed (100 points)
I have updated to the latest Rebex SFTP  but i'm still getting same error "Key exchange failed. Requested service is not implemented." any help?
commented Jun 13, 2018 by Lukas Pokorny (107,310 points)
Please create a log using Sftp object's LogWriter property (as described at https://www.rebex.net/kb/logging/) and either post it here or mail it to support@rebex.net for analysis. Thanks!
commented Oct 26, 2018 by RSchmertz (100 points)
I am getting a similar error, "Negotiation failed. Requested service is not implemented."
It's actually been intermittent, it failed last week. Started working again for a few days, then failed again this morning.
I was on 2018 R1.1.  I tried updating to R3 with the same problem.  I'm including logs from 1.1 and 3

2018-10-26 10:04:13.255 Opening log file.
2018-10-26 10:04:13.257 INFO FileLogWriter(1)[13] Info: Assembly: Rebex.Common 2018 R1.1 for .NET 4.0-4.7
2018-10-26 10:04:13.272 INFO FileLogWriter(1)[13] Info: Platform: Windows 6.1.7601 32-bit; CLR: 4.0.30319.42000
2018-10-26 10:04:13.272 DEBUG FileLogWriter(1)[13] Info: Culture: en; Windows-1252
2018-10-26 10:04:13.291 INFO Sftp(1)[13] Info: Connecting to SFTP.RENOWN.ORG:22 using Sftp.
2018-10-26 10:04:13.291 INFO Sftp(1)[13] Info: Assembly: Rebex.Sftp 2018 R1.1 for .NET 4.0-4.7
2018-10-26 10:04:13.291 INFO Sftp(1)[13] Info: Platform: Windows 6.1.7601 32-bit; CLR: 4.0.30319.42000
2018-10-26 10:04:13.291 DEBUG Sftp(1)[13] Info: Culture: en; Windows-1252
2018-10-26 10:04:13.307 DEBUG ProxySocket(1)[13] Proxy: Resolving 'SFTP.RENOWN.ORG'.
2018-10-26 10:04:13.311 DEBUG ProxySocket(1)[13] Proxy: Connecting to 204.115.221.12:22 (no proxy).
2018-10-26 10:04:13.401 DEBUG Sftp(1)[13] SSH: Server is 'SSH-2.0-7.7.1.0_openssh Please call support'.
2018-10-26 10:04:13.410 INFO Sftp(1)[13] SSH: Negotiation started.
2018-10-26 10:04:13.606 DEBUG Sftp(1)[13] SSH: Group exchange (legacy form).
2018-10-26 10:04:13.654 ERROR Sftp(1)[12] SSH: Error occured while receiving SSH packet: Rebex.Net.SshException: Requested service is not implemented.
   at Rebex.Net.SshSession.edof(Byte[] adq, Int32 adr, Int32 ads)
   at Rebex.Net.SshSession.edoe(Byte[] adn, Int32 ado, Int32 adp)
   at Rebex.Net.SshSession.edod()
   at Rebex.Net.SshSession.muoc.edpb()
2018-10-26 10:04:13.656 ERROR Sftp(1)[13] SSH: Negotiation failed. Requested service is not implemented.
2018-10-26 10:04:13.657 ERROR Sftp(1)[13] Info: Rebex.Net.SshException: Requested service is not implemented. ---> Rebex.Net.SshException: Requested service is not implemented.
   at Rebex.Net.SshSession.edof(Byte[] adq, Int32 adr, Int32 ads)
   at Rebex.Net.SshSession.edoe(Byte[] adn, Int32 ado, Int32 adp)
   at Rebex.Net.SshSession.edod()
   at Rebex.Net.SshSession.muoc.edpb()
   --- End of inner exception stack trace ---
   at Rebex.Net.SshSession.edny()
   at Rebex.Net.SshSession.edoa[a,b](bckp`2 adh, Int32 adi, bckq adj, b adk, a adl, a adm)
   at Rebex.Net.SshSession.edoh(murh adv)
   at murl.pvue(SshSession awy, Byte[] awz, Byte[] axa, Byte[] axb, Byte[] axc, murb& axd, Byte[]& axe, SshPublicKey& axf)
   at Rebex.Net.SshSession.edoj(Byte[] adw)
   at Rebex.Net.SshSession.Negotiate()
   at Rebex.Net.Sftp.yynz.cqmt(cfxh ame, Boolean amf)
   at Rebex.Net.Sftp.lshv(String qi, Int32 qj, SshParameters qk, cfxh ql)






2018-10-26 10:42:15.121 Opening log file.
2018-10-26 10:42:15.125 INFO FileLogWriter(1)[15] Info: Assembly: Rebex.Common 2018 R3 for .NET 4.0-4.7
2018-10-26 10:42:15.127 INFO FileLogWriter(1)[15] Info: Platform: Windows 6.1.7601 32-bit; CLR: 4.0.30319.42000
2018-10-26 10:42:15.127 DEBUG FileLogWriter(1)[15] Info: Culture: en; Windows-1252
2018-10-26 10:42:15.144 INFO Sftp(1)[15] Info: Connecting to SFTP.RENOWN.ORG:22 using Sftp.
2018-10-26 10:42:15.144 INFO Sftp(1)[15] Info: Assembly: Rebex.Sftp 2018 R3 for .NET 4.0-4.7
2018-10-26 10:42:15.144 INFO Sftp(1)[15] Info: Platform: Windows 6.1.7601 32-bit; CLR: 4.0.30319.42000
2018-10-26 10:42:15.144 DEBUG Sftp(1)[15] Info: Culture: en; Windows-1252
2018-10-26 10:42:15.155 DEBUG Sftp(1)[15] Proxy: Resolving 'SFTP.RENOWN.ORG'.
2018-10-26 10:42:15.158 DEBUG Sftp(1)[15] Proxy: Connecting to 204.115.221.12:22 (no proxy).
2018-10-26 10:42:15.243 DEBUG Sftp(1)[15] SSH: Server is 'SSH-2.0-7.7.1.0_openssh Please call support'.
2018-10-26 10:42:15.250 INFO Sftp(1)[15] SSH: Negotiation started.
2018-10-26 10:42:15.421 DEBUG Sftp(1)[15] SSH: Group exchange (legacy form).
2018-10-26 10:42:15.464 ERROR Sftp(1)[21] SSH: Error occured while receiving SSH packet: Rebex.Net.SshException: Requested service is not implemented.
   at Rebex.Net.SshSession.fmkq(Byte[] agf, Int32 agg, Int32 agh)
   at Rebex.Net.SshSession.fmkp(Byte[] agc, Int32 agd, Int32 age)
   at Rebex.Net.SshSession.fmko()
   at Rebex.Net.SshSession.itzj.fmlm()
2018-10-26 10:42:15.466 ERROR Sftp(1)[15] SSH: Negotiation failed. Requested service is not implemented.
2018-10-26 10:42:15.468 ERROR Sftp(1)[15] Info: Rebex.Net.SshException: Requested service is not implemented. ---> Rebex.Net.SshException: Requested service is not implemented.
   at Rebex.Net.SshSession.fmkq(Byte[] agf, Int32 agg, Int32 agh)
   at Rebex.Net.SshSession.fmkp(Byte[] agc, Int32 agd, Int32 age)
   at Rebex.Net.SshSession.fmko()
   at Rebex.Net.SshSession.itzj.fmlm()
   --- End of inner exception stack trace ---
   at Rebex.Net.SshSession.fmkj()
   at Rebex.Net.SshSession.fmkl[b,c](lcyp`2 afw, Int32 afx, lcyq afy, c afz, b aga, b agb)
   at Rebex.Net.SshSession.fmks(iuco agk)
   at iucs.xoag(SshSession azr, Byte[] azs, Byte[] azt, Byte[] azu, Byte[] azv, iuci& azw, Byte[]& azx, SshPublicKey& azy)
   at Rebex.Net.SshSession.fmku(Byte[] agl)
   at Rebex.Net.SshSession.Negotiate()
   at Rebex.Net.Sftp.srhy.frfl(nnui alr, Boolean als)
   at Rebex.Net.Sftp.xhez(String po, Int32 pp, SshParameters pq, nnui pr)
commented Oct 26, 2018 by Lukas Pokorny (107,310 points)
edited Nov 20, 2018 by Lukas Matyska
This error occurred after our SSH client tried to start a legacy form of Diffie-Hellman group exchange, which seems strange, because the server seems to be modern.
Are you setting Sftp object’s Settings.SshParameters.UseLegacyGroupExchange in your code?
In any case, please try setting that property to false before calling Sftp.Connect and if it still fails, please create and post an updated log.
...