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]