Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.
Comment: Passing in the CRYPT_NEWKEYSET flag to create a default keyset

...

Code Block
bgColor#ccccff
langc
#include <Windows.h>
#include <wincrypt.h>
#include <stdio.h>
 
HCRYPTPROV prov;
if (CryptAcquireContext(&prov, NULL, NULL, PROV_RSA_FULL, 0CRYPT_NEWKEYSET)) {
  long int li = 0;
  if (CryptGenRandom(prov, sizeof(li), (BYTE *)&li))
    printf("Random number: %ld\n", li);
  CryptReleaseContext(prov, 0);
}

...