fail to connect by public key (wodSFTP / wodSFTP.NET / wodSFTPdll)
Hi Simona,
please do not used that key anymore since you've shared it, generate new one for your usage.
I have managed to get your code running using wodKeys too. Here's the scenario. pKeys->GetPrivateKey returns BSTR, which you have to convert to (char *), and tha'ts what SetPrivateKey should have failed.
You can also use GetPrivateKeyData which returns SAFEARRAY, and you can handle that array as (char *). Code would be like this:
SAFEARRAY *psa = pKeys->GetPrivateKeyData(/*SSHKeyTypes::*/RSAkey);
void *data = NULL;
long lbound, ubound; // get array bounds
SafeArrayGetLBound(psa, 1 , &lbound);
SafeArrayGetUBound(psa, 1, &ubound);
SafeArrayAccessData(psa, &data);
Sftp_SetPrivateKey(handle, data, ubound-lbound+1);
SafeArrayUnaccessData(psa);
SafeArrayDestroy(psa);
So, we access SAFEARRAY, extract data from it, pass to SetPrivateKey, and destroy SAFEARRAY. I tested that code and it works ok.
Let me know how it goes for you!
Best regards,
Jasmine.
Complete thread:
- fail to connect by public key - simonasuciu, 2017-01-17, 14:38
- fail to connect by public key - Jasmine, 2017-01-17, 14:47
- fail to connect by public key - simonasuciu, 2017-01-18, 11:28
- fail to connect by public key - Jasmine, 2017-01-18, 11:29
- fail to connect by public key - simonasuciu, 2017-01-18, 15:05
- fail to connect by public key - Jasmine, 2017-01-18, 16:43
- fail to connect by public key - simonasuciu, 2017-01-19, 11:43
- fail to connect by public key - Jasmine, 2017-01-19, 11:44
- fail to connect by public key - simonasuciu, 2017-01-19, 12:13
- fail to connect by public key - Jasmine, 2017-01-19, 12:56
- fail to connect by public key - simonasuciu, 2017-01-19, 12:13
- fail to connect by public key - Jasmine, 2017-01-19, 11:44
- fail to connect by public key - simonasuciu, 2017-01-19, 11:43
- fail to connect by public key - Jasmine, 2017-01-18, 16:43
- fail to connect by public key - simonasuciu, 2017-01-18, 15:05
- fail to connect by public key - Jasmine, 2017-01-18, 11:29
- fail to connect by public key - simonasuciu, 2017-01-18, 11:28
- fail to connect by public key - Jasmine, 2017-01-17, 14:47