I am writing an automated uploader using Visual Studio 2010 and C#.

Using the code:
Sftp client = new Sftp();
client.LogWriter = new Rebex.FileLogWriter("c:\temp\log.txt", Rebex.LogLevel.Debug);
client.Connect("sftp.server.com");
client.Login(user, pass);

I can connect to the server using filezilla but not using rebex. A "key exchange failed" exception is thrown. "No common algorithms". Log file output below:

2012-01-19 12:57:40.197 Opening log file.
2012-01-19 12:57:40.889 INFO Sftp(1) Info: Connecting to sftp.server.com:22 using Sftp 2.0.4086.0 (trial version).
2012-01-19 12:57:41.383 DEBUG Sftp(1) SSH: Server is 'SSH-2.0-JSCAPE'.
2012-01-19 12:57:41.405 INFO Sftp(1) SSH: Negotiation started.
2012-01-19 12:57:41.681 DEBUG Sftp(1) SSH: Negotiating key.
2012-01-19 12:57:41.807 DEBUG Sftp(1) SSH: Negotiation failed: Rebex.Net.SshException:
Key exchange failed. Connection has been closed by the remote connection end; key exchange failed. No common algorithms. ---> Rebex.Net.SshException: Connection has been closed by the remote connection end; key exchange failed. No common algorithms.
at Rebex.Net.SshSession.cqLugQ(Byte[] , Int32 , Int32 )
at Rebex.Net.SshSession.AapcLiZ(Byte[] , Int32 , Int32 )
at Rebex.Net.SshSession.cDtmAOZ(cMbfbTZ , Object[] )
at Rebex.Net.SshSession.CFLiXJ(ANiLIV )
at wWGvS.miMck.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[] )

asked 20 Jan, 19:24

jjblinky's gravatar image

jjblinky
251
accept rate: 0%

Can you please send us the Rebex log file in Verbose level to support@rebex.net? We should be able to determine the cause of the error.

(23 Jan, 15:58) Lukas Matyska ♦♦

According to the log you sent us, this server only accepts connection from clients that support ZLIB compression. In Rebex SFTP, ZLIB compression is disabled by default. It has to be enabled first in order to connect to the server. This can be done using the following code:

C#

Sftp client = new Sftp();

// Create an instance of SshParameters class 
// to specify desired arguments. 
SshParameters par = new SshParameters();

// Enable transfer compression 
par.Compression = true;

// Connect to the server. 
// The third argument refers to the parameters class. 
client.Connect(hostname, Sftp.DefaultPort, par);

VB.NET

Dim client As New Sftp

' Create an instance of SshParameters class 
' to specify desired arguments. 
Dim par As New SshParameters

' Enable transfer compression 
par.Compression = True

' Connect to the server. 
' The third argument refers to the parameters class. 
client.Connect(hostname, Sftp.DefaultPort, par)
link

answered 24 Jan, 15:21

Lukas%20Pokorny's gravatar image

Lukas Pokorny ♦♦
2.2k18
accept rate: 32%

edited 24 Jan, 15:24

Thank you. This solved the issue and files are successfully transferred.

(24 Jan, 16:21) jjblinky
Your answer
toggle preview

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

Markdown Basics

  • *italic* or _italic_
  • **bold** or __bold__
  • link:[text](http://url.com/ "title")
  • image?![alt text](/path/img.jpg "title")
  • numbered list: 1. Foo 2. Bar
  • to add a line break simply add two spaces to where you would like the new line to be.
  • basic HTML tags are also supported

Tags:

×4

Asked: 20 Jan, 19:24

Seen: 113 times

Last updated: 24 Jan, 16:21