SSH Client connection (wodSSHTunnel)
Hi,
Here's the code, CKeys class is part of wodKeys.
I use wodSFTPdll.lib for my SSH client connection application.
#define RSAkey 0
#define DSAkey 1
#define DCSkey 2
void CSSHConnectionApp::KeyManager()
{
CKeys oKey; // Keys object
VARIANT sbitCount;
const CHAR *pPassword = "AuthenticationPassword";
vmyPassword.vt = VT_BSTR; // set to BSTR string
vmyPassword.bstrVal = SysAllocString((OLECHAR *)pPassword);
CString fNameClient= _T ("C:\\KeyValues.rsa");
CFile keyFile;
try
{
keyFile.Open((LPCTSTR)fNameClient, CFile::modeCreate | CFile::modeReadWrite);
}
catch(CFileException ex)
{
ex.ReportError();
keyFile.Abort(); // close file safely
}
try
{
sbitCount.iVal = oKey.get_BitCount(RSAkey);
oKey.Generate((long) RSAkey, sbitCount);
oKey.Save((long) RSAkey, (LPCTSTR)fNameClient, vmyPassword);
}
catch(CException* pe)
{
AfxMessageBox(_T("Error"));
pe->ReportError();
}
keyFile.Close();
return ;
}
Thank you,
Mariana
Complete thread:
- SSH Client connection - Mariana Cimpoca, 2016-12-13, 08:12
- SSH Client connection - Jasmine, 2016-12-13, 10:22
- SSH Client connection - Mariana Cimpoca, 2016-12-15, 10:20
- SSH Client connection - Jasmine, 2016-12-15, 10:43
- SSH Client connection - Mariana Cimpoca, 2016-12-15, 14:36
- SSH Client connection - Jasmine, 2016-12-15, 14:38
- SSH Client connection - Mariana Cimpoca, 2016-12-15, 15:24
- SSH Client connection - Jasmine, 2016-12-15, 21:12
- SSH Client connection - Mariana Cimpoca, 2016-12-22, 16:07
- SSH Client connection - Jasmine, 2016-12-22, 16:15
- SSH Client connection - Mariana Cimpoca, 2016-12-22, 16:07
- SSH Client connection - Jasmine, 2016-12-15, 21:12
- SSH Client connection - Mariana Cimpoca, 2016-12-15, 15:24
- SSH Client connection - Jasmine, 2016-12-15, 14:38
- SSH Client connection - Mariana Cimpoca, 2016-12-15, 14:36
- SSH Client connection - Jasmine, 2016-12-15, 10:43
- SSH Client connection - Mariana Cimpoca, 2016-12-15, 10:20
- SSH Client connection - Jasmine, 2016-12-13, 10:22