Host key not verified error

Discussion of open issues, suggestions and bugs regarding network security and data protection solution - SecureBridge
Post Reply
fuandi
Posts: 6
Joined: Mon 26 Feb 2018 03:16

Host key not verified error

Post by fuandi » Mon 26 Mar 2018 02:21

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;

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Host key not verified error

Post by ViktorV » Mon 26 Mar 2018 06:39

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.

fuandi
Posts: 6
Joined: Mon 26 Feb 2018 03:16

Re: Host key not verified error

Post by fuandi » Mon 26 Mar 2018 09:36

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 ?

ViktorV
Devart Team
Posts: 3168
Joined: Wed 30 Jul 2014 07:16

Re: Host key not verified error

Post by ViktorV » Tue 27 Mar 2018 07:07

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.

Post Reply