Last active
May 10, 2019 23:01
-
-
Save woachk/71cb7692b2f328dc7331f21161a37283 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include <windows.h> | |
#include <bcrypt.h> | |
#define STATUS_SUCCESS 0x00000000 | |
int main(void) { | |
NTSTATUS ntStatus = STATUS_SUCCESS; | |
BCRYPT_ALG_HANDLE hAlg = NULL; | |
BCRYPT_KEY_HANDLE hKey = NULL; | |
ntStatus = BCryptOpenAlgorithmProvider(&hAlg, BCRYPT_RSA_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0); | |
if (ntStatus != STATUS_SUCCESS) | |
exit(1); | |
ntStatus = BCryptGenerateKeyPair(hAlg, &hKey, 2047, 0); | |
if (ntStatus != STATUS_SUCCESS) | |
puts("Key generation failure."); | |
else | |
puts("Key generation success."); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment