Accept Host Key Automatically?

Mar 11, 2013 at 4:21 PM
Hello,

I am using this library within a .net application to connect to an SFTP server. It has been running for about a year without issue, and still is. I connect to the server through an automated process that requires no intervention.

The administrator of the SFTP server is changing the host key and has notified users that we need to accept the host key. I never had to accept the host key in the first place when I was initially connecting, so my instinct is that I don't need to do anything to accept the new one.

I don't do anything with the HostKeyReceived event, and I see that the default value of CanTrust in HostKeyEventArgs is true.

Does that mean that I am correct, that the new Host Key will be trusted by default?

Thanks,
Chip
Coordinator
Mar 11, 2013 at 6:33 PM
Hi Chip,

Yes, this is correct. By default it accepts all host keys.

The only time you want to use HostKeyReceived event if you want to add some logic and manually to approve or deny host.

Thanks,
Oleg
Mar 12, 2013 at 12:47 PM
Oleg,

That's great... thank you for confirming this and for your quick response!

Chip