Hello all,
I'm a new user to this forum, so please bear with me if I make newbie mistakes...
THE PROBLEM
I have a visual C++ encryption project that I need to reimplement in C# .NET environment using MS VS 2005. Reimplementing seems manageable, most of the code is fileIO and stream manipulation. The part I am not sure about is the encryption classes used. Specifically, are there parallels in C# that will perform the IDENTICAL encryption and decryption? The encryption and hashing functions used in the VC++ project are the following:
CryptAcquireContext(&hProv, NULL, NULL, PROV_RSA_FULL, 0)
CryptCreateHash(hProv,
CALG_MD5, 0, 0, &hHash)
CryptHashData(hHash, (unsigned char*)szPassword, strlen(szPassword), 0)
CryptDeriveKey(hProv,
CALG_RC4, hHash, (40 << 16) | CRYPT_EXPORTABLE, &hKey)
CryptDestroyHash(hHash)
CryptEncrypt(hKey, 0, eof, 0, pbBuffer, &dwCount, dwBufferLen)
CryptDestroyKey(hKey)
CryptDestroyHash(hHash)
CryptReleaseContext(hProv, 0)
QUESTIONS:
- For the functions listed above, are there parallel versions in C#?
- Does CALG_MD5 hashing exist in C#?
- Does CALG_RC4 encryption exist in C#?
- If 2 and 3 are true, will the reimplemented encryption be the same as the C++ version all things being equal?
Thanks much in advance.