HI
I am testing XCeed encrypt to encrypt data to be saved to a number of MS Access databases from C++ porgrams. With the help of Andre at Xceed I have been using the XCeed examples from both the encrypt and Binary encode controls to prove the princiipal but have run into a brick wall with the ToString function. No matter what I do when I call the ToString function I get error 80004003 back. I belive this has something to do with the parameters being invalid but have been unable to pin-point the problem Below is a sinppit of code which I hope will lead somebody to see where I am going wrong....
IXceedEncryptionPtr piEnc;
piEnc.CreateInstance( CLSID_XceedEncryption );
piEnc->License( _bstr_t( L"your license key" ) );
IXceedRijndaelEncryptionMethodPtr piRijndael;
piRijndael.CreateInstance( CLSID_XceedRijndaelEncryptionMethod );
piRijndael->SetSecretKeyFromPassPhrase( "This is a weak pass phrase!", 128 );
piEnc-> EncryptionMethod = IXceedEncryptDataPtr( piRijndael );
const char* pszSource = "This is the data to encrypt";
DWORD dwSourceSize = lstrlen( pszSource ) + 1;
BYTE* pcEncrypted = NULL;
DWORD dwEncryptedSize = 0;
piEnc->Encrypt( ( BYTE* )pszSource, dwSourceSize, TRUE, &pcEncrypted, &dwEncryptedSize ); //encrpt it
//now do the binary encoding
IXceedBinaryEncodingPtr piBinEncoder;
piBinEncoder.CreateInstance( CLSID_XceedBinaryEncoding );
piBinEncoder->License( _bstr_t( L"your license key" ) );
IXceedUUEncodingFormatPtr piUUEncode;
piUUEncode.CreateInstance( CLSID_XceedUUEncodingFormat );
piUUEncode->IncludeHeaderFooter = FALSE;
piBinEncoder->EncodingFormat = IXceedEncodeDataPtr( piUUEncode );
char* pcSource = (char*)pcEncrypted;
BYTE* pcEncoded = NULL;
DWORD dwEncodedSize;
//binary encode the output from encrypt
piBinEncoder->Encode(( BYTE* )pcSource, lstrlen( pcSource ), TRUE, &pcEncoded, &dwEncodedSize );
//now use the tostring function
BSTR* pszOutput = NULL;
HRESULT vTest;
vTest = piBinEncoder->ToString(( BYTE* ) pcEncoded, (DWORD)dwEncodedSize, pszOutput); //fails at this point with 80004003 error
Many Thanks for your help