-
-
Notifications
You must be signed in to change notification settings - Fork 940
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
SSH Host Key Fingerprint #835
Comments
You need to attach to the var client = new SftpClient(connectionInfo);
client.HostKeyReceived += (sender, e) =>
{
// e is an Renci.SshNet.Common.HostKeyEventArgs that you can use to check the received host key
// throw here to abort the connection
};
client.Connect(); |
@IgorMilavec Well, when I try this, I get this error var client = new SftpClient(config.Host, config.Port, config.User, config.Password);
client.HostKeyReceived += (sender, e) =>
{
e.CanTrust = true;
};
client.Connect(); Where I can attach config.Key = "ssh-rsa 2048 [...]="? |
You can not (AFAIK) "attach" the key, you must validate it inside HostKeyReceived event handler. Something like this: var client = new SftpClient(config.Host, config.Port, config.User, config.Password);
client.HostKeyReceived += (sender, e) =>
{
e.CanTrust = (FormatKey(e) == config.Key);
};
client.Connect(); Of course you need to implement |
@DouglasMarcelinoDev this is a duplicate of #859 , please see a workaround there. |
Using WinSCP DLL, I can configure my ssh host key fingerprint like this
SessionOptions sessionOptions = new SessionOptions
{
Protocol = Protocol.Sftp,
HostName = config.Host,
UserName = config.User,
PortNumber = config.Port,
Password = config.Password,
SshHostKeyFingerprint = config.Key
};
where config.Key = "ssh-rsa 2048 [...]="
How can I add this "SshHostKeyFingerprint" using SSH.NET dll?
something like that
client = new SftpClient(config.Host, config.Port, config.User, config.Password, config.Key);
The text was updated successfully, but these errors were encountered: