Host key wasn't verified
Hello I copied sample code from your tutorial, I create a console application in visual studio
I added your assembly to my references
As a matter of fact if I try this key with winscp sftp client, there's nothing wrong, I'm successfully logged in server. There's a page https://www.linode.com/docs/guides/transfer-files-with-winscp-on-windows/ about sftp winscp client tutorial, but if I try with this sample code it gives error
------------------------------------------------------------------------------------------
How can I solve this problem?
Thanks
I added your assembly to my references
static void Main(string[] args) { try { // Setup session options SessionOptions sessionOptions = new SessionOptions { Protocol = Protocol.Sftp, HostName = "xx.xx.com", UserName = "xxx", PortNumber = 19321, SshHostKeyFingerprint = "ssh-rsa 1024 a4:9b:a5:8f:fb:a0:b8:10:8d:28:44:e7:82:24:df:68", SshPrivateKeyPath = ("C:\\Users\\okeskiner\\Desktop\\id_dsa.ppk") }; using (Session session = new Session()) { // Connect session.Open(sessionOptions); // Upload files TransferOptions transferOptions = new TransferOptions(); transferOptions.TransferMode = TransferMode.Binary; TransferOperationResult transferResult; transferResult = session.PutFiles(@"c:\bideneme\*", "/test/", false, transferOptions); // Throw on any error transferResult.Check(); // Print results foreach (TransferEventArgs transfer in transferResult.Transfers) { Console.WriteLine("Upload of {0} succeeded", transfer.FileName); } } } catch (Exception e) { Console.WriteLine("Error: {0}", e); } Console.ReadKey(); }
------------------------------------------------------------------------------------------
Error: WinSCP.SessionRemoteException: Host key wasn't verified! ---> WinSCP.Sess ionRemoteException: Host key fingerprint is ssh-dss 1024 28:47:22:31:c8:36:04:db :31:0d:80:ec:9b:e3:49:c0. Authentication failed. --- End of inner exception stack trace --- at WinSCP.SessionLogReader.Read(LogReadFlags flags) at WinSCP.ElementLogReader.Read(LogReadFlags flags) at WinSCP.CustomLogReader.TryWaitForNonEmptyElement(String localName, LogRead Flags flags) at WinSCP.CustomLogReader.WaitForNonEmptyElement(String localName, LogReadFla gs flags) at WinSCP.CustomLogReader.WaitForNonEmptyElementAndCreateLogReader(String loc alName, LogReadFlags flags) at WinSCP.CustomLogReader.WaitForGroupAndCreateLogReader() at WinSCP.Session.Open(SessionOptions sessionOptions) at Youtubevideouploadapi.Program.Main(String[] args) in c:\Users\okeskiner\Do cuments\Visual Studio 2012\Projects\WebApplication\Youtubevideouploadapi\Program .cs:line 35
Thanks