EldoS | Feel safer!

Software components for data protection, secure storage and transfer

ElMemoryKeyStorage Class

Also by EldoS: Rethync
The cross-platform framework that simplifies synchronizing data between mobile and desktop applications and servers and cloud storages
#1682
Posted: 11/16/2006 12:45:00
by Mike Scriven (Standard support level)
Joined: 05/19/2006
Posts: 102

I'm adding Public Key authentication to my SSH Telnet application (VC++ MFC). When I go to add the ElMemoryKeyStorage control to my app. it doesn't appear in the Registered ActiveX Controls dialog. Am I doing something wrong?
#1683
Posted: 11/16/2006 13:21:40
by Eugene Mayevski (EldoS Corp.)

Can you please explain, in which IDE this dialog is located?


Sincerely yours
Eugene Mayevski
#1684
Posted: 11/16/2006 13:28:39
by Mike Scriven (Standard support level)
Joined: 05/19/2006
Posts: 102

Visual C++ 6.0 - Project, Add to Project, Components and Controls, Registered ActiveX Controls.
#1685
Posted: 11/16/2006 13:34:57
by Mike Scriven (Standard support level)
Joined: 05/19/2006
Posts: 102

I just spotted an ElSSHMemoryKeyStorageX class - presumably that's the one I should use?
#1687
Posted: 11/16/2006 15:07:01
by Ken Ivanov (EldoS Corp.)

Yes, exactly.
#1688
Posted: 11/16/2006 16:00:26
by Mike Scriven (Standard support level)
Joined: 05/19/2006
Posts: 102

OK but that class only adds two classes - CElSSHCustomKeyStorageX and CElSSHKeyX. Your documentation says I should use ElMemoryKeyStorage class (presumably that should be ElSSHMemoryKeyStorage) but that class doesn't get added.
#1689
Posted: 11/16/2006 17:46:12
by Ken Ivanov (EldoS Corp.)

It seems to be a problem of Visual Studio environment (it has certain problems with COM components). Actually, the best way to work with ActiveX components in VC6 is to access them directly using the interfaces they provide. SecureBlackbox distribution includes interface declarations (Wrappers\VC\AXWrappers directory). Please create the key storage object using CoCreateInstance() function and access it using the methods of IElSSHMemoryKeyStorageX interface. Though this approach is slightly more complex, it allows to avoid the problems caused by errors in wrappers automatically created by VC6.
#1690
Posted: 11/16/2006 18:59:43
by Mike Scriven (Standard support level)
Joined: 05/19/2006
Posts: 102

Thank you. Can you look over my code and let me know if it looks correct. I have no way of testing it at the moment.

IElSSHKeyX* pKey = NULL;
HRESULT hr = CoCreateInstance(CLSID_ElSSHKeyX,
NULL,
CLSCTX_INPROC_SERVER,
IID_IElSSHKeyX,
(void**)&pKey);
if (SUCCEEDED(hr))
{
CString strPrivateKeyFile = _T("C:\\Program Files\\Eldos\\SecureBlackBox.AX\\Certificates\\cert.key");
BSTR bstrPrivateKeyFile = strPrivateKeyFile.AllocSysString();
CString strPassPhrase;
BSTR bstrPassPhrase = strPassPhrase.AllocSysString();
pKey->LoadPrivateKey(bstrPrivateKeyFile, bstrPassPhrase);

IElSSHMemoryKeyStorageX* pKeyStorage = NULL;
HRESULT hr = CoCreateInstance(CLSID_ElSSHMemoryKeyStorageX,
NULL,
CLSCTX_INPROC_SERVER,
IID_IElSSHMemoryKeyStorageX,
(void**)&pKeyStorage);
if (SUCCEEDED(hr))
{
pKeyStorage->Clear();
pKeyStorage->Add(pKey);
pKey->Release();
m_pClient->SetKeyStorage(pKeyStorage);
}
}

Do you have a public SSH server that I could use to test it?

Thanks.
#1692
Posted: 11/17/2006 01:19:49
by Ken Ivanov (EldoS Corp.)

Quote
Thank you. Can you look over my code and let me know if it looks correct

Yes, the code is correct. However, you should also check the value returned by LoadPrivateKey() method, as this operation may fail for a number of reasons (e.g., if the key is badly formatted or the passphrase is incorrect). Besides, the pKey object is not released if pKeyStorage object was not created successfully.

Quote
Do you have a public SSH server that I could use to test it?

Unfortunately, no. Please consider using some free server (e.g., OpenSSH) for testing.
#1695
Posted: 11/17/2006 09:13:31
by Mike Scriven (Standard support level)
Joined: 05/19/2006
Posts: 102

OK, thank you. You guys have great support.
Also by EldoS: Solid File System
A virtual file system that offers a feature-rich storage for application documents and data with built-in compression and encryption.

Reply

Statistics

Topic viewed 3643 times

Number of guests: 1, registered members: 0, in total hidden: 0




|

Back to top

As of July 15, 2016 EldoS Corporation will operate as a division of /n software inc. For more information, please read the announcement.

Got it!