Re: C++(MFC) SFTP with PrivateKey - WeOnlyDo Discussion board

Re: C++(MFC) SFTP with PrivateKey (General questions)

by wodSupport, Friday, July 21, 2006, 19:13 (6509 days ago) @ OMOR

Omor,

can you try code like this (based on MFC/2. COM Object With Events sample), change void CWithEventsView::OnInitialUpdate() sample:
[code]if (!m_Ftp.CreateDispatch( WeOnlyDo.wodFtpDLXCom.1 ,NULL))
{
AfxMessageBox( Could not create wodFtpDLX object ,MB_OK,0);
return;
}
if (!m_Cert.CreateDispatch( WeOnlyDo.Certificate.1 ,NULL))
{
AfxMessageBox( Could not create Certificate object ,MB_OK,0);
return;
}

VARIANT var;
var.vt = VT_ERROR;
m_Cert.LoadKey( ... , var);
m_Cert.Load( ... , var);

// let's initialize FtpX events
m_FtpEvents = new CEventSink;;
LPUNKNOWN pUnknown= m_FtpEvents->GetIDispatch(FALSE);
AfxConnectionAdvise(m_Ftp.m_lpDispatch,DIID__IwodFtpDLXComEvents,pUnknown,FALSE,&m_Cookie);

// great, we have everything. Let's just inform events class about our existance :)
m_FtpEvents->m_pCtrl=this;


m_Ftp.SetHostname( your_hostname );
m_Ftp.SetLogin( your_login );
m_Ftp.SetPassword( not_needed );
m_Ftp.SetAuthentication(2); //authCertificate
m_Ftp.SetRefCertificate(m_Cert);[/code]

See how I set certificate and how I initialize? Can you try the same?

Regards,
Kreso


Complete thread: