I am trying to connect to a WinSCP server using the WinSCP.NET assembly. The problem I am facing is that it is bombarding a host key fingerprint verification. I created an RSA key. My code is as follows:
var server = new WinSCP.SessionOptions();
server.UserName = "ftp_user";
server.Password = "******";
server.HostName = "192.x.x.x";
server.Protocol = WinSCP.Protocol.Sftp;
server.SshHostKeyFingerprint =
"9f:39:52:d5:08:0c:1d:a8:02:c9:7e:44:49:7f:44:fb";
var session = new WinSCP.Session();
session.Open(server);
When assigning a property, SshHostKeyFingerprintI get the following error:
SSH host fingerprint "9f: 39: 52: d5: 08: 0c: 1d: a8: 02: c9: 7e: 44: 49: 7f: 44: fb" does not match pattern / (ssh-rsa | ssh-dss) ? \ d + ([0-9a-f] {2} :) {15} [0-9a-f] {2} (; (ssh-rsa | ssh-dss)? \ D + ([0-9a ]] {2} :) {15} [0-9a] {2}) * /
If I read this right, it checks 15 2 character sets, and I assign 16 to the set value. I got this value from the server.
UPDATE:
(ssh-dss ssh-rsa) (1024, 2048 ..). :
server.SshHostKeyFingerprint =
"ssh-rsa 1024 9f:39:52:d5:08:0c:1d:a8:02:c9:7e:44:49:7f:44:fb";
, , .
, - . .