Sample VC for login using certificate (wodSFTP / wodSFTP.NET / wodSFTPdll)
Hello,
I miss any working sample in vc++
to login on sftp server using authCertificate.
Can you please shortly write down, how
to implement this method?
An workaround with console-sample will be very welcome!
How to exchange key pairs with server,
how to know what kind of login is server preffered,
....
Thanks
Jan
[:smile:]
Re: Sample VC for login using certificate
You can insert this code into ConsoleApp sample. Make sure you upload public key to the server! [code]IKeysPtr pKeys = NULL;
VARIANT var;var.vt = VT_ERROR;
hr = pKeys.CreateInstance(CLSID_Keys, NULL);
if (FAILED(hr))
{
_com_error comErr (hr);
printf ( Unable to load IKeys interface.
Err # u: s , hr, comErr.ErrorMessage () );
CoUninitialize ();
return 99;
}
_bstr_t keypath = c:\mykey.rsa ;
try
{
hr = pKeys->Load(keypath, var);
} catch(_com_error e)
{
hr = e.Error();
}
if (FAILED(hr))
{
pKeys->Generate(RSAkey);
pKeys->Save(RSAkey, keypath, var);
BSTR b;
pKeys->get_PublicKeyOpenSSH(RSAkey, &b);
USES_CONVERSION;
MessageBox(NULL, OLE2T(b), Warning: make sure you upload public key to the server , MB_OK);
}
pFtpCom->put_Authentication(authPubkey);
var.vt = VT_DISPATCH;
var.pdispVal = pKeys;
pFtpCom->put_PrivateKey(var);[/code]
Re: Sample VC for login using certificate
pFtpCom->put_Authentication(authPubkey);
Hello,
thank you very much for this sample.
There is no enum authPubkey.
Should I put:
authCertificate
Thanks
Jan
[:happy:]
Re: Sample VC for login using certificate
oops, my mistake. I used wodSFTP :) But it's exactly the same thing with wodFtpDLX - use authCertificate instead. Thanks for pointing this out!