Microsoft does not publish a supported minimum ACL mask for “open and sign” with a Microsoft Software KSP key, so the preserved keys should remain unchanged and the exact provider-side access denial should be investigated through CNG auditing and Microsoft support rather than by guessing additional rights.
What the current DACL grants
The masks shown contain only standard security-administration rights:
-
READ_CONTROL(0x00020000): read the owner, group, and DACL. -
WRITE_DAC(0x00040000): modify the DACL. -
WRITE_OWNER(0x00080000): change the owner.
They contain no generic rights and no object-specific rights in bits 0–15. Standard rights govern security-descriptor operations; they do not inherently grant normal access to object contents or operations ^1^ ^2^.
Consequently, your DACL is consistent with this failure: the publisher can inspect security information, while Administrators can inspect and alter ownership or the DACL, but neither ACE expressly grants an object-specific or generic use right. However, Microsoft does not document the Microsoft Software KSP’s generic-right mapping or the exact access mask requested by NCryptOpenKey. It therefore cannot be stated from the public contract that a particular missing bit definitively caused this instance.
Successful creation and finalization do not disprove a reopen-access problem. The original handle was already established, and Microsoft software KSPs cache private-key material in LSA while a handle remains open. NCryptOpenKey starts a new retrieval after that handle is released ^3^.
Security context used during open
The documented architecture is:
- The application calls the key-storage router in
Ncrypt.dll. - The router uses LRPC to reach the key-isolation process.
- The Microsoft KSP runs in the LSA process.
- Private-key access passes through this architecture and is audited ^4^.
That establishes where provider processing occurs, not which token is used for this provider’s backing-object access check. The public CNG documentation does not say whether this specific check uses:
- the caller’s primary token,
- an impersonation token representing the caller,
- LSA/SYSTEM’s token, or
- multiple checks under different contexts.
General Windows RPC impersonation rules say that access checks use the client’s impersonation token while a server is impersonating, but that does not document whether or when Microsoft Software KSP performs impersonation ^5^. Therefore, describing the check simply as “SYSTEM access” or “caller access” would be unsupported.
Least privilege and deletion
The public CNG contract documents a security descriptor for persisted keys and permits setting its DACL through NCRYPT_SECURITY_DESCR_PROPERTY ^6^ ^7^. It does not publish:
- a
KEY_SIGNor equivalent CNG ACL right; - an “open/use but not delete” access mask;
- the Microsoft Software KSP’s generic-right mapping; or
- separate documented ACL authorization requirements for
NCryptSignHash.
This creates an important limitation: a documented DACL recipe guaranteeing open/sign while preventing NCryptDeleteKey cannot be derived from the public API. NCryptDeleteKey accepts a key handle obtained through NCryptOpenKey, and its documentation does not identify a separate required access right ^8^.
Do not grant the publisher:
-
WRITE_DAC, -
WRITE_OWNER, or -
DELETE
if the account must not modify ownership/security or receive an explicit standard delete right. But omitting those rights alone is not a documented guarantee that a caller able to open and use the key cannot delete it through the KSP.
For deployment, separate control should therefore be added outside the undocumented KSP ACL mapping—for example, run signing behind a narrowly scoped signing service and do not give the publisher process direct possession of an open KSP handle. The exact service design and authorization policy are application-level controls, not CNG access-mask guarantees.
Diagnostics without changing the preserved keys
Enable the documented Microsoft KSP audit category from an elevated command prompt:
auditpol /set /subcategory:"other system events" /success:enable /failure:enable
auditpol /get /subcategory:"other system events"
Reproduce only NCryptOpenKey, then preserve:
- the Security log;
- the failing 5061 event and its caller/process fields;
- provider name, key name, unique name, flags, and status;
- the security descriptor in SDDL and binary form;
- the key-file metadata and ACL;
- Windows edition, build, and patch level.
Microsoft documents that persistent-key reads/writes and relevant cryptographic failures are audited, and that Microsoft KSP audit records are generated in user mode in LSA ^9^.
ETW can supplement those records, but the public ETW documentation describes the tracing framework rather than a Microsoft Software KSP event that exposes the exact desired access mask and token ^10^. There is no documented public tool that decodes this failure into “SID X was denied mask Y by ACE Z” inside the Microsoft Software KSP.
Because the original keys are preserved and the missing rights/provider mapping are undocumented, submit the artifacts through Microsoft support and request analysis of the CNG/LSA provider trace. Test candidate ACLs only on newly generated disposable keys; changing the preserved DACL would destroy the evidence needed to distinguish an access-check failure from another provider retrieval failure. NTE_BAD_KEYSET alone means the key could not be found/opened under the documented NCryptOpenKey contract and does not identify the failed internal check ^3^.
References