Host key does not match configured key
I am totally new to this winscp and I have pull the files from the unix box using winscp
I have got below url to refer and code.
https://winscp.net/eng/docs/library_session_listdirectory#example
I have coded accordingly below is my code
Try
' Setup session options
Dim mySessionOptions As New SessionOptions
With mySessionOptions
.Protocol = Protocol.Sftp
.HostName = TxtHost.Text
.UserName = TxtUName.Text
.Password = TxtPwd.Text
.PortNumber = 22
.SshHostKeyFingerprint = TxtKey.Text
End With
LblInfo.Text = LblInfo.Text & "Assigned Session Options" & vbNewLine
Dim mySession As New Session
Using mySession
LblInfo.Text = LblInfo.Text & "Session declared " & vbNewLine
mySession.Open(mySessionOptions)
LblInfo.Text = LblInfo.Text & "Connected" & vbNewLine
Dim directory As RemoteDirectoryInfo = mySession.ListDirectory(TxtSource.Text)
LblInfo.Text = LblInfo.Text & "Setting Transfer Options " & vbNewLine
Dim fileInfo As RemoteFileInfo
LblInfo.Text = "-----------------------------------------------------"
For Each fileInfo In directory.Files
'Console.WriteLine("{0} with size {1}, permissions {2} and last modification at {3}", _
'fileInfo.Name, fileInfo.Length, fileInfo.FilePermissions, fileInfo.LastWriteTime)
LblInfo.Text = LblInfo.Text & fileInfo.Name.ToString & " with size " & fileInfo.Length.ToString & ", permissions " & fileInfo.FilePermissions.ToString & " and last modification at " & fileInfo.LastWriteTime.ToString & vbNewLine
'lblinfo.Text = "copied file : " & vbNewLine
Next
LblInfo.Text = "-----------------------------------------------------"
End UsingMy SshHostKeyFingerprint is like below format
ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx
but when I try to open session I get below error
Host key does not match configured key "
ssh-rsa 1024 xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx:xx"!
Where am I going wrong and someone help me getting it corrected asap