Show private key state & allow healing#16
Open
episource wants to merge 7 commits into
Open
Conversation
NTE_BAD_KEYSET is raised *before* a key is actually retrieved. It means the provider cannot locate the requested key container. This is not a mismatch. It only means a card using the same provider is accessable.
This was referenced Jul 22, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The following changes are introduced:
NTE_BAD_PUBLIC_KEYorNTE_BAD_KEY. Both are likely related to corruption/misconfiguration of the system's certificate store.NTE_BAD_PUBLIC_KEYissues**) On my systems I needed to fiddle with the CERT_KEY_PROV_INFO_PROP_ID provider property associated with a cert to force
NTE_BAD_PUBLIC_KEY: I've overwritten this with the value of another certificate (for another key slot, but sharing the same algorithm parameters). Enabling healing worked around this forcedNTE_BAD_PUBLIC_KEY. I'm not aware of negative side effects that might come along with the healing, other that it might change persistent provider data.I could imagine, that
NTE_BAD_PUBLIC_KEYmight also occur, when the key on the smartcard is recreated / overwritten without updating the computer's or key file's cached certificate. Was not able to easily reproduce this though (e.g. overwriting a yubikey PIV slot led to "not connected" /NTE_BAD_KEYSETduring my testing).