0

I am kind of stuck, I want to generate new pair of public and private keys. But I can't find a way to extract them.

I used this: (C++)

    status = BCryptOpenAlgorithmProvider(&hAlg,
                                         BCRYPT_RSA_ALGORITHM,
                                         NULL,
                                         0);

    if (status) {}

    status = BCryptGenerateKeyPair(hAlg, &hKey, 1024, 0);

    if (status) {}

    status = BCryptFinalizeKeyPair(&hKey, 0);

    if (status) {}

(dont mind the status, ill check it later :-) ) but now I want to extract the pair of keys, cant find an example or matching function I might do something wrong, but what?

B00t
  • 9
  • 3

1 Answers1

0

"export it to?" BCryptExportKey functionexports a key to a memory BLOB that can be persisted for later use.

And then you could use the BCryptImportKeyPair function imports a public/private key pair from a key BLOB.

Jeaninez - MSFT
  • 3,210
  • 1
  • 5
  • 20