I am calling the encode and decode functions in my unit test cases. Below is an extract from them.
Here the source data (pData) and the encrypted and then decrypted data (pDecryptedData) should have eventually come to be the same string i.e; "SampleTextSampleSampleTextSampleSampleTextSampleSampleTextSampleSampleTextSampleSampleTextSampleSampleTextSampleSampleTextSample"
but that is not happening. pDecryptedData is something weird.
char pData[] = "SampleTextSampleSampleTextSampleSampleTextSampleSampleTextSampleSampleTextSampleSampleTextSampleSampleTextSampleSampleTextSample";
DataEncryption::encryptData(DataEncryption::ENC_DEFAULT, 256, pData, sizeof(pData), pEncryptedData, encryptedLength)
DataEncryption::decryptData(DataEncryption::ENC_DEFAULT, 256, pEncryptedData, encryptedLength, pDecryptedData, decryptedLength)
if(!strcmp(pData,static_cast<char*>(pDecryptedData)))
{
cout<<"Same";
}
else
{
cout<<"Not Same";
}