Failed to import private key - how to overcome? - WeOnlyDo Discussion board

Failed to import private key - how to overcome? (wodSFTP / wodSFTP.NET / wodSFTPdll)

by PaulM, Friday, January 27, 2012, 19:11 (4684 days ago)

I am struggling to connect to an SFTP server. I have the following code:

[code]
WeOnlyDo.Security.Cryptography.KeyManager keyM = new WeOnlyDo.Security.Cryptography.KeyManager();
keyM.Load(privateKeyFile, password);

WeOnlyDo.Client.FtpDLX wodFtpDLX = new WeOnlyDo.Client.FtpDLX();
wodFtpDLX.LicenseKey = licenseKey;
wodFtpDLX.Protocol = WeOnlyDo.Client.Protocols.SFTP;
wodFtpDLX.Authentication = WeOnlyDo.Client.Authentications.PublicKey;

wodFtpDLX.Hostname = ftpAddress;
wodFtpDLX.Login = userName;

wodFtpDLX.PrivateKey = keyM.PrivateKey(WeOnlyDo.Security.Cryptography.SSHKeyTypes.RSAKey);
wodFtpDLX.Blocking = true;
wodFtpDLX.Connect();
[/code]

If the private key password is incorrect, I get the Failed to import private key error immediately so I know the key is being loaded without issue. The error is only being raised when I try to connect to the server. It is immediate so I am guessing it is when the key is trying to be loaded on to the client. Have I set any of the properties incorrectly or are there any which I have failed to set?

Much appreciated.


Complete thread: