Microsoft does not publicly document a GENERIC_MAPPING or a set of object-specific access-right constants for persisted keys in the Microsoft Software Key Storage Provider, so the file-object mapping must not be used as an authoritative NCrypt key mapping.
Generic mapping
NCRYPT_SECURITY_DESCR_PROPERTY is documented as returning a SECURITY_DESCRIPTOR containing access-control information for a persistent key. The documentation also defines NCRYPT_SECURITY_DESCR_SUPPORT_PROPERTY for determining whether a provider supports key security descriptors.^1^
However, the NCrypt and Software KSP documentation does not publish:
- A
GENERIC_MAPPINGfor these descriptors. - Software-KSP-specific access bits corresponding to sign, decrypt, export, or delete.
- A statement that the key descriptor uses
FILE_GENERIC_READ,FILE_GENERIC_WRITE, orFILE_GENERIC_EXECUTE.
Generic rights are object-type dependent. The file mapping applies specifically to files and directories; another securable object can map the same generic bits differently.^2^ Therefore, the Software KSP’s file-backed implementation does not establish that its NCrypt key descriptor has file-object semantics. CNG deliberately places access to private keys behind the key-storage router and key-isolation architecture.^3^
For 0xD01F01FF, the generic portion is:
0x80000000 // GENERIC_READ
0x40000000 // GENERIC_WRITE
0x10000000 // GENERIC_ALL
That decomposition is valid, but expanding those bits requires the missing provider-specific mapping. Interpreting the low-order 0x01FF as file rights would be an undocumented inference.
Operation-specific permissions
The public NCrypt contract documents operations, not corresponding ACL access masks:
- Signing is performed with
NCryptSignHash.^4^ - The security descriptor is changed by calling
NCryptSetPropertywithNCRYPT_SECURITY_DESCR_PROPERTYand the appropriateSECURITY_INFORMATIONflags.^5^ - Deletion is performed with
NCryptDeleteKey; that function deletes the key and releases its handle.^6^
Windows defines standard rights such as DELETE, READ_CONTROL, WRITE_DAC, and WRITE_OWNER, but the available documentation does not explicitly state which of them the Software KSP checks for the corresponding NCrypt calls. In particular, there is no documented native CNG equivalent of managed CryptoKeyRights that can be treated as the authoritative access-mask definition.
Consequently, do not assert from the descriptor alone that:
- Signing corresponds to a particular low-order bit.
-
WRITE_DACnecessarily predicts whetherNCryptSetPropertywill succeed. -
DELETEnecessarily predicts whetherNCryptDeleteKeywill succeed.
Those interpretations may be plausible Windows security conventions, but they are not a published Software KSP contract.
Effective-access evaluation
AccessCheck is a supported read-only evaluator for a security descriptor and an impersonation token, but it requires the correct object-specific GENERIC_MAPPING. The desired mask must first be passed through MapGenericMask so that it contains no generic bits.^7^ Microsoft’s private-object guidance states the same requirement.^8^
The normal pattern is:
DWORD desired = /* documented rights for this object type */;
GENERIC_MAPPING mapping = /* documented mapping for this object type */;
MapGenericMask(&desired, &mapping);
BOOL granted = FALSE;
DWORD grantedMask = 0;
AccessCheck(sd, impersonationToken, desired, &mapping,
privilegeSet, &privilegeSetSize,
&grantedMask, &granted);
For a Software KSP key, the two comments cannot be filled authoritatively from the published NCrypt documentation. Supplying the file mapping would answer a different question: what access the token would receive if the descriptor governed a file object.
MAXIMUM_ALLOWED does not solve this. Although AccessCheck can return the maximum rights granted by a descriptor, interpreting the resulting bits still requires the correct object-right definitions and mapping.^7^
AuthzAccessCheck is likewise not a workaround: it evaluates requested access against a descriptor for an Authz client context, but the caller must still know what access mask represents the operation being tested.^9^
Practical conclusion
For compliance-grade verification:
- Retrieve and validate the descriptor structure, owner, group, DACL protection, ACE types, trustees, and raw masks.
- Treat generic bits as unresolved unless Microsoft supplies the Software KSP mapping.
- Do not normalize them with file, registry, or another object type’s mapping.
- Do not claim non-invasive proof of sign, security-change, or deletion permission from
AccessCheck. - Obtain a documented mapping and operation-mask contract through a Microsoft support case if the verification must predict provider behavior without invoking the operations.
The descriptor can still be compared against an expected raw descriptor under your own provisioning contract, but that is descriptor conformance—not authoritative effective-access evaluation for NCrypt operations.
References
- Key Storage Property Identifiers
- Generic access rights
- Key Storage and Retrieval
- NCryptSignHash function (ncrypt.h)
- NCryptSetProperty function (ncrypt.h)
- NCryptDeleteKey function (ncrypt.h)
- AccessCheck function (securitybaseapi.h)
- Checking Access to Private Objects
- AuthzAccessCheck function (authz.h)