Zoltan Kerenyi

Zoltan Kerenyi

  • NA
  • 72
  • 13.5k

winscp SFTP without sshHosKey

Dec 8 2020 12:54 PM
Hi,
 
I got this chunk of code:
 
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = "192.168.50.100",
UserName = "user",
Password = "pass",
PortNumber = 22,
};
using (Session session = new Session())
{
session.Open(sessionOptions);
}
 
It fails, because SshHostKeyFingerprint = "ssh-rsa 2048 xxxxxxxxxxx...="
wasnt given. I could copy that out when for instance FileZilla tells me to accept, but how could this be done in the program? So it should be automatically accepted.
 
Do you have any idea? How should I set SshHostKeyPolicy.AcceptNew ?
 
Thanks
 
Zolee 
 

Answers (1)