locked
CryptAcquireContext returns -2146893802 RRS feed

  • Question

  • Hi All,

    I am trying to encrypt a file  using https://msdn.microsoft.com/en-us/library/windows/desktop/aa382358(v=vs.85).aspx the code but as I am debugging this code it is giving me an error code in getlasterror of CryptAcquireContext .

    Can anyone help me with this.

    Wednesday, April 6, 2016 12:58 PM

All replies

  • The decimal -2146893802 error is

    NTE_BAD_KEYSET
    0x80090016L

    The key container could not be opened. A common cause of this error is that the key container does not exist. To create a key container, call CryptAcquireContext using the CRYPT_NEWKEYSET flag. This error code can also indicate that access to an existing key container is denied. Access rights to the container can be granted by the key set creator by using  CryptSetProvParam.

    Wednesday, April 6, 2016 5:14 PM