Thanks for the log! The following section looks very interesting:
. 2012-02-24 11:54:58.957 Reading private key file "C:\Rebex\GTP_Test\gtp_test_private.ppk"
! 2012-02-24 11:54:58.972 Using username "testsftp".
. 2012-02-24 11:54:59.207 Offered public key
. 2012-02-24 11:54:59.457 Offer of public key accepted
! 2012-02-24 11:54:59.457 Authenticating with public key "rsa-key-20120208"
. 2012-02-24 11:54:59.457 Prompt (3, SSH key passphrase, , Passphrase for key "rsa-key-20120208": )
! 2012-02-24 11:55:05.676 Access denied
. 2012-02-24 11:55:05.676 Access denied
. 2012-02-24 11:55:05.676 Prompt (7, SSH password, , &Password: )
. 2012-02-24 11:55:05.676 Using stored password.
. 2012-02-24 11:55:05.676 Sent password
. 2012-02-24 11:55:07.660 Access granted
This shows that WinSCP's public key authentication attempt was actually rejected as well (this corresponds to Rebex SFTP's attempt), but then the client tried password authentication and succeeded. This means there are two possibilities:
1) The server doesn't know anyhing about your public key, but the account password is sufficient for authentication. In this case, try calling Sftp.Login(userName, password) instead of Sftp.Login(userName, password, privateKey).
2) The server requires a public key authentication before password authentication can proceed, but reports "failure" error code instead of proper "partial success". Some of our clients have encountered such servers in the past. To solve this, the following workaround could be used:
Sftp client = new Sftp();
client.Connect(...);
try
{
SshPrivateKey privateKey = new SshPrivateKey(keyPath, keyPassword);
client.Login(userName, privateKey);
}
catch (SftpException)
{
client.Login(userName, password);
}
Please note that there is a bug in Rebex SFTP v2.0.4086.0 that causes a NullReferenceException to be thrown when using this workaround. To solve this, I will e-mail you a link to the current build of Rebex SFTP that solves this issue.