Re: Why is SshHostKeyFingerprint needed when SshPrivateKeyPath is set to private key file
@SK: So please follow the link included in my previous post.
Before posting, please read how to report bug or request support effectively.
Bug reports without an attached log file are usually useless.
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = _sftpConfig.Value.HostName,
UserName = _sftpConfig.Value.UserName,
PortNumber = _sftpConfig.Value.Port,
SshPrivateKeyPath = sftpKeyPath
};
ScanFingerprint
only to implement an interactive prompt to get the public key verified by an user.
SessionOptions.GiveUpSecurityAndAcceptAnySshHostKey
.
Session
class a bit further and found the ScanFingerprint
method to get the public key, including the example. Using this, I was able to get my code to work as expected.
When I connect manually using the GUI WinSCP client to an SFTP site, I specify Host Name, User Name and Private Key File. No password or fingerprint is needed to connect.
System.ArgumentException: SessionOptions.Protocol is Protocol.Sftp or Protocol.Scp, but SessionOptions.SshHostKeyFingerprint is not set.