Hi!
does anyone have working example of CryptGenrRandom class to generate session id (need to use in my iis module).
HCRYPTPROV hCryptProv;
BYTE pbData[16];
if(CryptAcquireContext( &hCryptProv, NULL, NULL, PROV_RSA_FULL, CRYPT_VERIFYCONTEXT))
{
if(CryptGenRandom(hCryptProv, 8, pbData))
{
std::string s(( const char *) pbData);
printf(s.c_str());
}
else
{
MyHandleError("Error during CryptGenRandom.");
}
}
else
{
MyHandleError("Error during CryptAcquireContext!\n");
}
i tried this code but, its not working quite well (i get it from msdn) and this example don't work for me ( http://www.codeproject.com/KB/security/plaintextsessionkey.aspx )
so if anyone know how to generate sessionid using this class plz let me know
tnx anyway!