What does HRESULT 0x80090016 (NTE_BAD_KEYSET) mean?

 
Previous Next
NTE_BAD_PUBLIC_KEY NTE_PROV_TYPE_NOT_DEF

NTE_BAD_KEYSET

NTE_BAD_KEYSET (0x80090016) is a classic CryptoAPI error indicating that a requested key container could not be opened. The container may be missing, inaccessible to the current identity, or requested with the wrong provider or key-store scope.

Persistent and temporary key contexts

A key container is identified by the combination of its provider and container name. Code that only hashes data, encrypts with temporary keys, or verifies signatures normally does not need a persisted private-key container and can acquire a context with CRYPT_VERIFYCONTEXT. Code that needs a persisted private key must open the intended container under the identity and scope where that key was created.

Useful checks

  • Confirm the provider name, provider type, container name, and whether the application expects a user or machine keyset.
  • For services, verify the service account and profile or machine-keyset choice rather than testing only under an interactive administrator account.
  • Create a container with CRYPT_NEWKEYSET only when the application is establishing its own new key material. A missing container can also mean that an existing key is inaccessible or that the wrong identity is in use.
  • Keep the key-container naming scheme stable; changing a provider or scope makes an existing container appear absent.

See Microsoft documentation for CryptAcquireContext.


Looking for a different code? Search another status or error code.