title: How to get the SSH fingerprint from a server with WinSCP and C#
body: <p>I want to get the fingerprint when the user is accessing to the server for the first time, and then save that fingerprint (this would not be a problem, I can do this). My problem is that there's supposed to be a method to do that called <code>ScanFingerprint()</code> but that one is not displayed when I'm searching for it.</p>
  <p><a href="https://winscp.net/eng/docs/library_session_scanfingerprint#parameters" rel="nofollow noreferrer">https://winscp.net/eng/docs/library_session_scanfingerprint#parameters</a></p>
  <p>That's what I've found, but the method does not appear, any idea how to do this?</p>
  <p>To be honest, I've not done any code for this, due to the fact that I'm trying to figure out where that method is. But I have this, which I'm planning to use to set the <code>SshHostKeyFingerprint</code> property</p>
  <pre><code>TransferOptions = new TransferOptions();
  SessionOptions = new SessionOptions();
  MySession = new Session();
  
  SessionOptions.HostName = InterfaceConnection.Host;
  SessionOptions.UserName = InterfaceConnection.UserID;
  SessionOptions.Password = InterfaceConnection.Password;
  SessionOptions.PortNumber = InterfaceConnection.Port;
  
  if (string.Compare(protocol.ProtocolUsed, &quot;FTP&quot;, true) == 0)                
      SessionOptions.Protocol = WinSCP.Protocol.Ftp;
  else if (string.Compare(protocol.ProtocolUsed, &quot;SFTP&quot;, true) == 0)
  {
      SessionOptions.Protocol = WinSCP.Protocol.Sftp;                    
      SessionOptions.SshHostKeyFingerprint = protocol.FingerPrint;
      SessionOptions.SshPrivateKeyPath = &quot;C:\\TestFiles\\SshKeys\\MyLocalSSHKey&quot;;
  }
  </code></pre>