this.SessionOptions = new SessionOptions();
this.SessionOptions.HostName = HostName;
this.SessionOptions.UserName = UserName;
this.SessionOptions.PortNumber = PortNumber;
this.SessionOptions.Password = Password;
this.SessionOptions.Protocol = Protocol;
this.SessionOptions.SshHostKeyFingerprint = SshHostKeyFingerprint;
try
{
m_Session.Open(this.SessionOptions);
}
catch (Exception exp)
{
}
if i set correctly SshHostKeyFingerprint all work
if SshHostKeyFingerprint empty i get exception "SessionOptions.Protocol is Protocol.Sftp or Protocol.Scp, but SessionOptions.HostKey is not set."
but for gui winscp get correctly SshHostKeyFingerprint automatically
Using SSH protocol version 2
We claim version: SSH-2.0-WinSCP_release_5.1.4
Doing Diffie-Hellman group exchange
Doing Diffie-Hellman key exchange with hash SHA-1
Verifying host key rsa2 0x23,0xb9c35c82f30eaaf274a76...
Asking user:
The server's host key was not found in the cache. You have no guarantee that the server is the computer you think it is.
The server's rsa2 key fingerprint is:
ssh-rsa 1024 55:aa:e9:fa:b0:4c:66:e0:ea:cc:4f:34:bf:e2:45:f0
If you trust this host, press Yes. To connect without adding host key to the cache, press No. To abandon the connection press Cancel.
Continue connecting and add host key to the cache? ()
Host key fingerprint is:
ssh-rsa 1024 55:aa:e9:fa:b0:4c:66:e0:ea:cc:4f:34:bf:e2:45:f0
Initialised AES-256 SDCTR client->server encryption
Initialised HMAC-SHA1 client->server MAC algorithm
Initialised AES-256 SDCTR server->client encryption
how i get correctly SshHostKeyFingerprint automatically from c# code?