i am using the SSH.Net to upload files to some sftp servers.
for all the servers i have the ip, port, username, password and fingerprint.
the fingerprint is a string, which looks like : "ssh-rsa 2048 5b:eb:4e:ef:ab:cd:25:2c:37:58:b6:2d:08:d5:56:12".
for the SftpClient i supply all the data without the fingerprint, and it connects fine.
now i want to validate again the connection and compare the host's fingerprint with the one i have.
i find according to the first part the encryption (ssh-rsa) and find the HostKeyAlgorithms.
now i have the value, but still can't see the fingerprint string to compare with the one i have.
using (SftpClient sftp = new SftpClient("SftpServerIpAddress", 22, "SftpUserName", "SftpPassword"))
string key = @"ssh-rsa 2048 5b:eb:4e:ef:ab:cd:25:2c:37:58:b6:2d:08:d5:56:12";
string fingerprint = key.Split(' ');
var keyAlgorithm = sftp.ConnectionInfo.HostKeyAlgorithms.FirstOrDefault(k => k.Key.StartsWith(fingerprint));
if (fingerprint == keyAlgorithm.Value.ToString())
//no no no
i'd really appreciate your help here.