Sample VC for login using certificate - WeOnlyDo Discussion board

Sample VC for login using certificate (wodSFTP / wodSFTP.NET / wodSFTPdll)

by Jan, Friday, February 18, 2005, 12:03 (7217 days ago)

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

by wodSupport, Sunday, February 20, 2005, 23:14 (7215 days ago) @ Jan

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

by Jan, Monday, February 21, 2005, 09:48 (7214 days ago) @ wodSupport

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

by wodSupport, Monday, February 21, 2005, 10:08 (7214 days ago) @ Jan

oops, my mistake. I used wodSFTP :) But it's exactly the same thing with wodFtpDLX - use authCertificate instead. Thanks for pointing this out!