Difference in Windows Cryptography Service between VC++ 6.0 and VS 2008

I have a class of encryption that was developed in Microsoft Visual C++ 6.0, and it is working properly. I migrated the code to Microsoft Visual Studio 2008, this class is working, but with a different behavior.

When I pass a specific string for encryption, the encryption result generated in the compiled code in Visual C + + 6.0 is different than in Visual Studio 2008, and it should not happen.

Can anyone help me understand why this is happening?

Cryptography functions of the Windows Services used:

HCRYPTPROV hProv;
HCRYPTHASH hHash;
HCRYPTHASH hKey;
CString strDataKey;
DWORD dwSize;
DWORD dwSizeEncrypted;
BYTE * aszEncryptedBuffer;

.........(Other codes.....).......

CryptAcquireContext (& hProv, NULL, MS_STRONG_PROV, PROV_RSA_FULL, 0);

CryptCreateHash (hProv, CALG_MD5, 0, 0, & hHash);

CryptHashData (hHash, (const unsigned char *) strDataKey, dwSize, 0);

CryptDeriveKey (hProv, CALG_RC2, hHash, CRYPTDERIVEKEY_FLAG, & hKey);

aszEncryptedBuffer = new BYTE[dwSizeEncrypted];

memcpy(aszEncryptedBuffer,"Data to be encrypted",dwSize);

CryptEncrypt (hKey, 0, TRUE, 0, aszEncryptedBuffer, & dwSize, dwSizeEncrypted);

Thanks!
No idea. You should post @ MSDN: http://social.msdn.microsoft.com/Forums.
Topic archived. No new replies allowed.