Yes, this is exactly what the method does. Just keep in mind that first the password authentication is performed and only if the server requires the key authentication after it, then the private key authentication is performed. In case the SFTP server lets the user authenticate with password only, then the Login(username, password, privatekey) method also succeeds. So it is more on the server to decide. However, our method is exactly what you need for servers that require the double authentication,