Trouble using authPubkey authentication (wodSFTP / wodSFTP.NET / wodSFTPdll)
Hi, I'm developing a simple program in vc that has to extract a private key from a db and then do an ssh to an host using that key.
When I connect using password authentication everything works fine, but when I to use key auth the connect() method returns me a strange value (-2146798272).
I can't figure out what I'm doing wrong, can you help me ?
Thanks.
Damiano
Here's a sample of my code
m_SSH2->put_Blocking(VARIANT_TRUE);
m_SSH2->put_Hostname(ip);
m_SSH2->put_Login(user);
m_SSH2->put_Protocol(protocol);
m_SSH2->put_Authentication(authPubkey);
m_SSH2->put_Port(2222);
m_SSH2->put_Prompt(vExpectedPrompt);
//gets the private key from db
//row[1] holds is a pointer (char *) to the private key data
row= get_private_key();
numchar = (long) (strlen(row[1]));
Bufsize = (long) (sizeof(char *) * numchar);
SAFEARRAY *psa;
SAFEARRAYBOUND rgsabound[1];
char HUGEP *data;
rgsabound[0].lLbound=0;
rgsabound[0].cElements=Bufsize;
psa = SafeArrayCreate(VT_UI1,1,rgsabound);
if (!psa)
return WSA_NOT_ENOUGH_MEMORY;
SafeArrayAccessData(psa, (void HUGEP* FAR*)&data);
memcpy(data,row[1], Bufsize);
SafeArrayUnaccessData(psa);
VARIANT var;
var.vt =VT_ARRAY | VT_UI1;
var.parray=psa;
m_SSH2->put_PrivateKey(var);
ConnectRetCode = m_SSH2->Connect();
//Here ConnectRetCode is - 2146798272