I have a windows application (Visual Studio is used) that uses Microsoft CryptoAPI. Now it is required to develop a Mac OS X application, that is capable to read data, encrypted by the WinApp, and encrypt data on Mac OS X, that will be decrypted by the WinApp. Encryption/decription in the WinApp initialized in the such way:
::CryptAcquireContext(&m_hCryptProv, NULL, MS_DEF_PROV, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT);
::CryptCreateHash(m_hCryptProv, CALG_MD5, 0, 0, &m_hCryptHash);
::CryptHashData(m_hCryptHash, pbtPSW, dwPSWLen, 0);
::CryptDeriveKey(m_hCryptProv, CALG_RC4, m_hCryptHash, 0, &m_hCryptKey);
And for encryption/decription the following is used:
::CryptEncrypt(m_hCryptKey, 0, TRUE, 0, pBuf, &dwCnt, dwLen);
::CryptDecrypt(m_hCryptKey, 0, TRUE, 0, pBuf, &dwCnt);
As I understand, I need to find a library that implements MD5 hashing plus RC4 encoding/decoding. It seems that there are a number of such libraries. For example: matrixSSL, OpenSSL. But using of the libraries for my puproses is not obvious (especially taking into account, that I am not familiar with Sequrity/Crypting APIs). Could somebody recommend a particular ciphering library? May be there are code examples for my task?
ADDITION:
It seems the main problem is that I need a portable analog of the ::CryptDeriveKey, that is compatible with Microsoft version (i.e. generates the same key). Does anybody know a such one? Or an algorithm of creating a key by the ::CryptDeriveKey?