GiveUpSecurityAndAcceptAnySshHostKey is it really working?

Advertisement

registereduser
Joined:
Posts:
2

GiveUpSecurityAndAcceptAnySshHostKey is it really working?

I'm not sure if I'm in the right section of forum.

We C# application where code below works fine if SshHostKeyFingerprint information provided.
SessionOptions sessionOptions = new SessionOptions
   {  Protocol = Protocol.Sftp,
      HostName = "ftp.N.com",  
      UserName = "N", 
      Password = "@#$%",  
      SshHostKeyFingerprint="ssh-rsa 2048 ....."
     };
But to provide info for for SshHostKeyFingerprint I manfully (it changes daily) open WinSCP copy ssh info from it then paste it to our application. Is their a way to automatically accept new one? I look in to what you have on site but looks like some of thing obsoleted now. I tried to replace SshHostKeyFingerprint="" with GiveUpSecurityAndAcceptAnySshHostKey = true and GiveUpSecurityAndAcceptAnyTlsHostCertificate = true. It did not work. Is it supposed to work the way I need it? Can someone point me to clear C# code which works?

Reply with quote

Advertisement

martin
Site Admin
martin avatar
Joined:
Posts:
41,442
Location:
Prague, Czechia

Re: GiveUpSecurityAndAcceptAnySshHostKey is it really working?

Yes, SessionOptions.GiveUpSecurityAndAcceptAnySshHostKey is working. Though it's indeed obsolete. You should use SessionOptions.SshHostKeyPolicy = SshHostKeyPolicy.GiveUpSecurityAndAcceptAny.
https://winscp.net/eng/docs/library_sessionoptions#sshhostkeypolicy
If it does not work for you, we need your code and session log file.

Reply with quote

Advertisement

You can post new topics in this forum