title: SSH.NET Authenticate via private key only (public key authentication)
body: <p>Attempting to authenticate via username and privatekey only using the current SSH.NET library.  I cannot get the password from the user so this is out of the question.</p>
  
  <p>here is what i am doing now.</p>
  
  <pre><code>Renci.SshNet.ConnectionInfo conn = 
      new ConnectionInfo(hostName, port, username, new AuthenticationMethod[]
          {
              new PasswordAuthenticationMethod(username, ""), 
              new PrivateKeyAuthenticationMethod(username, new PrivateKeyFile[] 
                     { new PrivateKeyFile(privateKeyLocation, "") }),
          });
  
  using (var sshClient = new SshClient(conn))
  {
      sshClient.Connect();
  } 
  </code></pre>
  
  <p>Now, if I remove the <code>PasswordAuthenticationMethod</code> from the <code>AuthenticationMethod[]</code> array I get an exception for for no suitable authentication method found.  If i attempt to pass in the (hostname, port, username, keyfile2) as such </p>
  
  <pre><code>var keyFile = new PrivateKeyFile(privateKeyLocation);
  var keyFile2 = new[] {keyFile};
  </code></pre>
  
  <p>again, no suitable method found.</p>
  
  <p>It seems I have to use the <code>ConnectionInfo</code> object as I outlined above, but it seems that it evaluates the <code>PasswordAuthenticationMethod</code> and cant log in (since i don't provide a password) and never evaluates the <code>PrivateKeyAuthMethod</code>... is this the case?  Is there some other way to authenticate with only a username or hostname and private key using SSH.NET lib?</p>