EldoS | Feel safer!

Software components for data protection, secure storage and transfer

Error message: connection Lost when trying to connect to SFTP.

Posted: 11/15/2008 22:34:42
by  Rachana Dikshit
I am already using SBSimpleSftp for connecting to 2 SFTP's since a long time.I need to connect to a new SFTP now and I have done the same settings as the previous SFTP's in the code.I am getting the following error when I try to upload some files to the FTP . Also note I am able to connect to the SFTP from the same server using WINSCP.Do I need to do any setting regarding the licence key for connecting to the ne SFTP?
Error message:
SBSimpleSftp.EElSimpleSFTPClientException: Connection lost
at SBSimpleSftp.TElSimpleSFTPClient.DoSend(Object Sender, Byte[] Buffer)
at SBSSHCommon.TElSSHClass.DoSend(Byte[] Buffer, Int32 Size)
at SBSSHClient.TElSSHClient.SSH2SendOnTransportLayer(Int32 Size)
at SBSSHClient.TElSSHClient.SSH2SendKexDHInit()
at SBSSHClient.TElSSHClient.SSH2ParseKexInit(Byte[] Buffer, Int32 Size)
at SBSSHClient.TElSSHClient.SSH2ParseOnTransportLayer(Byte[] Buffer, Int32 Size)
at SBSSHClient.TElSSHClient.AnalyseBuffer()
at SBSSHClient.TElSSHClient.DataAvailable()
at SBSimpleSftp.TElSimpleSFTPClient.DataAvailable()
at SBSimpleSftp.TElSimpleSFTPClient.IntMessageLoop()
at SBSimpleSftp.TElSimpleSFTPClient.DoMessageLoop()
at SBSimpleSftp.TElSimpleSFTPClient.Open()
at SFTPClient..ctor(String server, String userName, String Password, Int32 port)

I connect to the SFTP as follows:
_ftpXMLDirectory = ConfigurationSettings.AppSettings["HHFTPXMLDirectory"];
_ftpZIPDirectory = ConfigurationSettings.AppSettings["HHFTPZIPDirectory"];
_ftpPort = 22;
_ftpServer = ConfigurationSettings.AppSettings["HHFTPURI"];
_ftpUserName = ConfigurationSettings.AppSettings["HHFTPUserName"];
_ftpPassword = ConfigurationSettings.AppSettings["HHFTPPassword"];

SOmeone please help me understand why I am getting this error.
Posted: 11/16/2008 01:47:42
by Eugene Mayevski (Team)

Does the problem happen during handshake (i.e. when you call Open) or when you initiate file transfer? In any case check the articles here

Sincerely yours
Eugene Mayevski
Posted: 11/16/2008 09:47:34
by  Rachana Dikshit
The error 'Connection Lost' is thrown after I try to call the method OPEN of the :SecureBlackbox.SFTP.dll$v2.0.50727\SBSimpleSftp.TElSimpleSFTPClient.cs
I successfully connect to 2 other FTP using the same settings I have in my code, but when I try to connect to this new SFTP, I am geting the 'connection lost' error.Is this due to the key based authentication?Also I am not sure if I am using key based authentatication.Please refer the code snippet and help me understand.As per the articles in the link above,I tried turing the compression off, but same error.Please help me understand what I need to do to set the key based authentication on the SFTP server and client.If there is any article on how to do that then please let me know.
Here is my code snippet.
SBSimpleSftp.TElSimpleSFTPClient SftpClient;
TElSSHMemoryKeyStorage KeyStorage

KeyStorage = new TElSSHMemoryKeyStorage();
SftpClient.KeyStorage = KeyStorage;

SftpClient.Password = Password;
SftpClient.Username = userName;
SftpClient.Address = server;
SftpClient.Port = port;

SftpClient.AuthenticationTypes = SftpClient.AuthenticationTypes & (~SBSSHConstants.Unit.SSH_AUTH_TYPE_PUBLICKEY);

I am able to connect to the SFTP server using winscp client.

Posted: 11/16/2008 09:56:33
by Eugene Mayevski (Team)

You seem to have not read the articles I have pointed to. Please do read them before going further - the articles contain detailed explanation and steps to solve the problem.

Sincerely yours
Eugene Mayevski
Posted: 11/16/2008 10:23:02
by  Rachana Dikshit
Hello Eugene,
I have read the article: "SSH or SFTP connection to the server is not established (connection is closed during handshake). WTF?"
, and I now understand that I need to set some private/Public key encryption.
I do have an encryption key I use for the other 2 SFTP's I connect to using secure black box dll.
However, for this New SFTP, how do I set the private/public keys?It is not mentioned anywhere on the artice how to set the 'Public key authentication'.Please verify the code snippet above and confirm If I am using Public key authentication , and also how to set it ?
Please help me, as I was not the initial programmer who had done this for the other 2 SFTP's and I am unaware of how to do it.
ANy help will be highly appreciated.

Posted: 11/16/2008 10:41:23
by Eugene Mayevski (Team)

The error happens because the server doesn't like some parameter of the connection. This is usually some algorithm. Authentication method is most likely not the case - if you connect using WinSCP to this server and you don't know about public/private keys, then most likely the server uses password or keyboard-interactive authentication. So what you need to do is play with the algorithms as described in the above mentioned article. You need to disable them and start enabling them one by one until some combination works.

Another thing you can do is give us the server's address and we'll try to connect ourselves. This will be faster.

Also, - you mentioned some "initial programmer". Are you the licensed user of the library? Also, what exactly version of SecureBlackbox are you using? Version can be checked by viewing the properties of some SecureBlackbox assembly.

Sincerely yours
Eugene Mayevski
Posted: 11/16/2008 11:46:06
by  Rachana Dikshit
Thanks Eugene for your quick response.
We have a licenced version of the Secure black box and we use it for the past 1.5 years.
The version we use is :
The server I am trying to connect to is:ftp.harte-hanks.com
I am using the following dll's for the SFTP connection and have not done enabled or disabled any particular properties, other than the what is given in the code snippet above:
Please help me out to understand which particular one needs to be enabled.

thanks a lot.
Posted: 11/16/2008 11:52:52
by Eugene Mayevski (Team)

Moved to HelpDesk for licensing questions.

Sincerely yours
Eugene Mayevski
Posted: 11/16/2008 13:35:16
by  Rachana Dikshit
The licence is under the name of TIAA-CREF.Please confirm again.
Also , where can I get the licence key from?Please let me know.
Posted: 11/16/2008 13:52:26
by  Rachana Dikshit
WHich Open SSH server is used by corpftp.merrillcorp.com and ftp4.wilde.com, because to these 2 SFTP's I am able to connect fine since the last 1.5 years.



Topic viewed 6251 times

Number of guests: 1, registered members: 0, in total hidden: 0


Back to top

As of July 15, 2016 EldoS business operates as a division of /n software, inc. For more information, please read the announcement.

Got it!