CryptAcquireContext fails on other machines
-
Hello All, I have an application that runs without error on my own system. Even in release mode :-D. However, when i run the application on other systems, my app reports to me that it was undable to aquire a crypt context (CryptAcquireContext) due to an invalid param. This code is called in a simple C worker thread. Any Ideas?
UINT stringHash(byte* message, char* hash){ DWORD hashLen = 16; HCRYPTPROV hCryptProv; HCRYPTHASH hHash; // zeroing just in case CryptAquireContext is getting garbage somehow ZeroMemory(&hCryptProv, sizeof(hCryptProv)); ZeroMemory(&hHash,sizeof(hHash)); BYTE hashedBytes[16]; // Aquire Crypto Handle - fails if (!CryptAcquireContext(&hCryptProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, 0)){ CryptReleaseContext(hCryptProv,0); return GetLastError(); } ...
-
Hello All, I have an application that runs without error on my own system. Even in release mode :-D. However, when i run the application on other systems, my app reports to me that it was undable to aquire a crypt context (CryptAcquireContext) due to an invalid param. This code is called in a simple C worker thread. Any Ideas?
UINT stringHash(byte* message, char* hash){ DWORD hashLen = 16; HCRYPTPROV hCryptProv; HCRYPTHASH hHash; // zeroing just in case CryptAquireContext is getting garbage somehow ZeroMemory(&hCryptProv, sizeof(hCryptProv)); ZeroMemory(&hHash,sizeof(hHash)); BYTE hashedBytes[16]; // Aquire Crypto Handle - fails if (!CryptAcquireContext(&hCryptProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, 0)){ CryptReleaseContext(hCryptProv,0); return GetLastError(); } ...
Hello... Yes, i believe i have an idea... I think on the other machines it isn't the requested CSP installed (this are dll's which provides cryptography algorithm)... For more information read: http://msdn.microsoft.com/library/default.asp?url=/library/en-us/seccrypto/security/cryptographic_service_providers.asp[^] Best regards...:)
-
Hello All, I have an application that runs without error on my own system. Even in release mode :-D. However, when i run the application on other systems, my app reports to me that it was undable to aquire a crypt context (CryptAcquireContext) due to an invalid param. This code is called in a simple C worker thread. Any Ideas?
UINT stringHash(byte* message, char* hash){ DWORD hashLen = 16; HCRYPTPROV hCryptProv; HCRYPTHASH hHash; // zeroing just in case CryptAquireContext is getting garbage somehow ZeroMemory(&hCryptProv, sizeof(hCryptProv)); ZeroMemory(&hHash,sizeof(hHash)); BYTE hashedBytes[16]; // Aquire Crypto Handle - fails if (!CryptAcquireContext(&hCryptProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, 0)){ CryptReleaseContext(hCryptProv,0); return GetLastError(); } ...
knave45 wrote: if (!CryptAcquireContext(&hCryptProv, NULL, MS_ENHANCED_PROV, PROV_RSA_FULL, 0)){ CryptReleaseContext(hCryptProv,0); return GetLastError(); } You are trying to acquire the handle to key container "Microsoft Enhanced Cryptographic Provider " with the parameter MS_ENHANCED_PROV . The 9x system may not be having this key container with it. So try to get handle to some other key container. Or use NULL to get the handle to the default key container. If you don't like defaults !! try MS_DEF_PROV which is there with all window flavors i guess... -- Best Regards Suhredayan
suhredayan
There is no spoon.