1

I'm working on an application in which user will enter encryption key via GUI and my app will fetch that encryption key. Now i need to store that received key into Microsoft key container. I got this and this as a starting point and i know that i have to use this only. I am able to create key inside the container but i don't want to use this key. I have to store user entered key inside the container for later use in encryption/decryption process. Help highly appreciated. Thank you.

1

I think the link you provided above is one off--check here instead, which covers key import (what you need to start with). In short, you'll invoke BCryptImportKey or BCryptImportKeyPair, depending on if you're dealing with symmetric or asymmetric keys.

Once imported, use the various functions provided in CNG, probably starting with BCryptDecrypt and BCryptEncrypt.

  • Thanks for your comment. I tried to use this example but it returned me 'BCryptOpenAlgorithmProvider@24' not declared. After lots of googling i come to know that to use this function required lib is crypt32.lib. I linked that lib file even though getting same error. Now i want to know whether it's possible to do what i want to do. I want to save my own key in to key container. is it possible? If yes can you explain some what in detail? I as stucked here since last 10 days. Help me. – liveforFun Mar 18 '15 at 6:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.