locked
Crypto API looking for the right forum RRS feed

  • Question

  • Hello all,

    I found the Crypto API sample on the MSDN website: http://msdn.microsoft.com/en-us/library/ms867086.aspx

    I downloaded the project (5003 link under Abstract) and compiled the executable in VS2005. On my Win7 64bit machine (the machine that I built the exe) the encrypt exe works fine. I am trying to get this to work on a couple of other 32 bit operating systems (Win XP and WinPe). When trying to execute on both i get the error:

     

     Comes from NTE_BAD_KEYSET when doing

     

    CryptAcquireContext. I am trying to find out if anyone knows the differences in WinPe or Xp that cause this function not to work. I am guessing differences in the registry structure but not sure. Any guidance to the correct forum would be appreciated

     

    "The Registry entry for the key container could not be opened and may not exist."

     

    Friday, January 20, 2012 2:47 PM

Answers

  • althurm wrote:

    Comes from NTE_BAD_KEYSET when doing CryptAcquireContext

    Yes, it bites a lot of people. When you get this error, call  CryptAcquiteContext again with CRYPT_NEWKEYSET flag. There's an example  in CryptAcquiteContext docs.


    Igor Tandetnik

    • Marked as answer by althurm Monday, January 23, 2012 6:01 PM
    Friday, January 20, 2012 3:02 PM

All replies

  • althurm wrote:

    Comes from NTE_BAD_KEYSET when doing CryptAcquireContext

    Yes, it bites a lot of people. When you get this error, call  CryptAcquiteContext again with CRYPT_NEWKEYSET flag. There's an example  in CryptAcquiteContext docs.


    Igor Tandetnik

    • Marked as answer by althurm Monday, January 23, 2012 6:01 PM
    Friday, January 20, 2012 3:02 PM
  • Thanks
    Friday, January 20, 2012 4:42 PM