SFTP Keyboard Interactive Authentication

May 22, 2013 at 12:02 PM

I'm trying to get files via sftp, but I can figure out which classes I need to use.
At first I tried to connect by simply using an SftpClient object, like shown in an example I found

    using (var sftp = new SftpClient(host, username, password))

        using (var file = File.OpenRead(localFileName))
            sftp.UploadFile(remoteFileName, file);

but sftp.Connect(); throws an SSHAuthenticationException;

Connecting to the server via putty i recognized it uses keyboard-interactive authentication and tried to creat the SftpClient like this:
            KeyboardInteractiveConnectionInfo conInfo = new KeyboardInteractiveConnectionInfo(host, port, username);

            SftpClient client = new SftpClient(conInfo);
Which throws an ArgumentNullException.

Whats the right way to creat an SftpClient connection?