Re: WodKeys GetPrivateKey returns an empty string - WeOnlyDo Discussion board

Re: WodKeys GetPrivateKey returns an empty string (General questions)

by Arun, Thursday, September 21, 2006, 21:44 (6638 days ago) @ wodSupport

One more note - you probably use MFC which converts BSTR to CString for you. That's why you receive 0 string - because BSTR contains binary data and conversion done by MFC fails. You should convert it by yuorself using WideCharToMultiByte

Hi Kreso,

Thanks for your answer. Actually I am passing in a CComBStr.
[code]CComBSTR bsPrivateKey;
hr = m_pWodKeysCom->get_PrivateKey( ( SSHKeyTypes )type, &bsPrivateKey );[/code]
I do not convert it to a CString. I have tried setting the Private key property directly with a string before connecting and it works. Its the load and get_PrivateKey operation that is failing. We receive a file and hence the load operation makes it easier. If not, we have to read the file, store the contents in a byte array and then use it.

Any suggestion is welcome :)
Thanks
Arun


Complete thread: