Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- void decrypt(LPBYTE data, DWORD size, LPSTR key, DWORD algo)
- {
- HCRYPTPROV hProv;
- CryptAcquireContext(&hProv, 0, 0, PROV_RSA_AES, CRYPT_VERIFYCONTEXT);
- HCRYPTHASH hHash;
- CryptCreateHash(hProv, CALG_MD5, 0, 0, &hHash);
- CryptHashData(hHash, (LPBYTE)key, strlen(key), CRYPT_USERDATA);
- HCRYPTKEY hkey;
- CryptDeriveKey(hProv, algo, hHash, CRYPT_EXPORTABLE , &hkey);
- CryptDecrypt(hkey, NULL, TRUE, 0, data, &size);
- CryptDestroyHash(hHash);
- CryptReleaseContext(hProv, 0);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement