Please do not judge; I am out of my element in C++., but trying to learn. Again, please do not judge - I am trying to use a function that decrypts an AES 256 bit message with CAPICOM. When I run my program in the VC++ (VS 2008) debugger, I can clearly see the decrypted string in _bstr_t variable:( plainText). When the value is passed back to the calling program, the content is missing. Here is the function call in my program, and the entire CAPICOM Decrypt function. I have a C background, and proficient in VB. Trying to wrap my addled brain around the necessary * chars below satisfied the compiler. ANY and ALL assistance will be so very appreciated - I've hit the wall.
Tim
*sDataCID = *Decrypt(sDataCID, sKey);
char *Decrypt(char *pszStr, char *pszKey)
{
int size;
char *buf;
//char plainText;
_bstr_t plainText;
IEncryptedDataPtr encryptor;
size = strlen(pszStr);
buf = new char[size + 1];
buf[size] = 0;
encryptor.CreateInstance("CAPICOM.EncryptedData");
encryptor->SetSecret(_bstr_t(pszKey), CAPICOM_SECRET_PASSWORD);
encryptor->Decrypt(_bstr_t(pszStr));
plainText = encryptor->GetContent();
return plainText;
}