Page 1 of 1

Host key not verified error

Posted: Mon 26 Mar 2018 02:21
by fuandi
Hi, currently i'm using trial version of secure bridge. I tried these codes below to connect to sftp server.
And I got this error Project1.exe raised exception class EScError with message 'Host key not verified'

But when I tried using winscp or filezilla, I'm able to connect.
Not sure what is wrong with my source code below

ScSSHClient.HostName := 'hello.com';
ScSSHClient.Port := 22;
ScSSHClient.User := 'blablabla';
ScSSHClient.Authentication := atPassword;
ScSSHClient.Password := 'blablabla';

ScSSHClient.Connect;

Re: Host key not verified error

Posted: Mon 26 Mar 2018 06:39
by ViktorV
The "Host key not verified" error occurs if the key received from the server and the key specified in HostKeyName do not match. You should handle the TScSSHClient.OnServerKeyValidate event. You can find the more detailed information about this event in SecureBridge help. Also you can look at the sample of this event handling in the SFTPClient demo project. The SFTPClient demo project is located at %SecureBridgeDemos%\SFTPClient. %SecureBridgeDemos% is the path where SecureBridge demo projects are installed on your computer.

Re: Host key not verified error

Posted: Mon 26 Mar 2018 09:36
by fuandi
Thanks, I can connect now using sftpclient demo.
I've problem viewing/browse the root folder. It shows nothing/blank in the treeview. Can help me ?

Re: Host key not verified error

Posted: Tue 27 Mar 2018 07:07
by ViktorV
To get the files in the root directory, you should execute the SFTPClient.OpenDirectory method with the ".." parameter. For example:
SFTPClient.OpenDirectory ('..');
In our SFTPClient demo sample, just set the value .. in the path input field and click the Start SFTP button.
If this does not help to solve your task, please make sure that in our SFTPClient demo sample the ScSSHClient.NonBlocking property is set to False. Also, specify the directory that is read when you connect using Filezilla.