Hi,
I'm currently trying to authenticate a login using a username, password and public key. I am receiving the following error: "A public key corresponding to the supplied private key was not accepted by the server or the user name is incorrect."
I am able to log in successfully without the private key, so I know the user name is not the issue.
I generated the public/private key pair using the following code:
var privateKey = SshPrivateKey.Generate(SshHostKeyAlgorithm.RSA, 2048);
privateKey.Save(@"C:\MyData\PrivateKey.pri", "password", SshPrivateKeyFormat.OpenSsh);
privateKey.SavePublicKey(@"C:\MyData\PublicKey.pub", SshPublicKeyFormat.Ssh2Base64);
The public key generated by this code has been saved with the user on the SFTP server.
I'm then attempting to log in using the following code:
// load the private key
SshPrivateKey privateKey = new SshPrivateKey(@"C:\MyData\PrivateKey.pri", "password");
// Authenticate
client.Login(username, password, privateKey);
I believe the server being used to connect to is Bitvise, could someone advise where I'm going wrong? Thanks.