fail to connect by public key - WeOnlyDo Discussion board

fail to connect by public key (wodSFTP / wodSFTP.NET / wodSFTPdll)

by Jasmine, Wednesday, January 18, 2017, 16:43 (2867 days ago) @ simonasuciu

Hi Simona,

yes, wodSFTPdll works for us without any issues. Here's my code I tested with. If you send email to techsupport - at - weonlydo.com, I can provide full code and key you can test with to try it out with our server. Here's partial key since it's too large to paste here (and, of course, I can't just let anyone connect for tests...)

Note I don't use wodKeys - it's not needed with wodSFTPdll since it's capable of loading key using LoadPrivateKey when you give full key instead of filename.

Here's the code:

 char buf[8192];
 handle = Sftp_Create(&mystruct, NULL);
 Sftp_SetBlocking(handle, 1);
 Sftp_SetHostname(handle, "linux.weonlydo.com");
 Sftp_SetLogin(handle, "weonlydo");
 Sftp_SetAuthentication(handle, /*AuthenticationsEnum::*/authPubkey);
 Sftp_LoadPrivateKey(handle, "-----BEGIN RSA PRIVATE KEY-----\r\nMIIEoQIBAAKCAQE....Me0sT4YJ0g6FYBP2Dvdw+Q==\r\n-----END RSA PRIVATE KEY-----\r\n", NULL);

 printf("Connecting...\r\n");
 Sftp_SetPort(handle, 22);
 int i = Sftp_Connect(handle);

So, code is more/less same as yours, connecting against OpenSSH server running on Ubuntu linux.

Kind regards,
Jasmine.


Complete thread: