CryptAcquireContext Take long time to return?
#include "stdafx.h"
#include <windows.h>
#include <wincrypt.h>
int main(int argc, char* argv[])
{
HCRYPTPROV hProv;
if(!CryptAcquireContext(&hProv,
NULL,
NULL,
PROV_RSA_FULL,
0))
{
if(GetLastError() == NTE_BAD_KEYSET )
{
CryptAcquireContext(&hProv,
NULL,
NULL,
PROV_RSA_FULL,
CRYPT_NEWKEYSET);
}
else
return FALSE;
}
if(!CryptAcquireContext(&hProv,
NULL,
NULL,
PROV_RSA_FULL,
0))
return FALSE;
return 0;
}
the first CryptAcquireContext the return value is zero,
the second CryptAcquireContext takes long time to return ,the return value is zero?
Any ideas what could be causing this behavior?