What generic access-rights mapping applies to NCrypt keys in the Microsoft Software Key Storage Provider?

Mathieu Carlson 0 Reputation points
2026-10-25T01:10:50.1866667+00:00

Subject: Generic access-rights mapping for NCrypt persisted keys in Microsoft Software Key Storage Provider

I am implementing security-descriptor verification for a user-scoped RSA signing key persisted through the Microsoft Software Key Storage Provider.

The key's security descriptor is retrieved through NCryptGetProperty using NCRYPT_SECURITY_DESCR_PROPERTY.

The descriptor contains a protected DACL with three explicit ACCESS_ALLOWED ACEs for the intended user, SYSTEM, and Administrators.

The ACE access mask is 0xD01F01FF, which includes generic, standard, and object-specific rights.

I would appreciate clarification on the following:

Generic mapping: What GENERIC_MAPPING applies to security descriptors for persisted keys managed by the Microsoft Software Key Storage Provider? Is the Windows file-object mapping appropriate, or does the provider use a distinct mapping?

Operation-specific permissions: Which access rights govern using a persisted key for signing, changing its security descriptor, and deleting it? Are these rights defined by native CNG/NCrypt constants or another authoritative specification?

Effective-access verification: Is there a supported read-only method for evaluating whether a particular Windows access token has these permissions for a persisted Software KSP key, without performing a signature, changing permissions, or deleting the key?

AccessCheck: If AccessCheck is appropriate for the retrieved security descriptor, what generic mapping and desired-access masks should be supplied? Are there provider-specific restrictions that AccessCheck would not capture?

I understand that successful NCryptOpenKey and a signing-only NCRYPT_KEY_USAGE_PROPERTY do not independently establish all the caller's effective permissions.

I am looking for a documented native Windows approach rather than an inference from filesystem ACLs or managed .NET CryptoKeyRights values.

Thank you.

Windows development | Windows API - Win32
0 comments No comments

2 answers

Sort by: Newest
  1. Percy Nguyen (WICLOUD CORPORATION) 240 Reputation points Microsoft External Staff Moderator
    2026-10-26T04:41:11.7833333+00:00

    Hi @Mathieu Carlson ,

    Thanks for posting your questions.

    I haven’t found a public Microsoft reference that specifies the Microsoft Software KSP’s GENERIC_MAPPING or maps each NCrypt operation to its required ACE access mask. The documented answer is therefore limited:

    1. Generic mapping: The documentation for NCRYPT_SECURITY_DESCR_PROPERTY identifies the property as a persisted key’s security descriptor, but does not define the mapping. Your mask is:
      
         GENERIC_READ | GENERIC_WRITE | GENERIC_ALL | 0x001F01FF
      
      
      Although 0x001F01FF equals FILE_ALL_ACCESS, that numerical match does not establish a supported Software KSP mapping. I would not use it as authoritative justification for supplying the file-object mapping.
    2. Operation-specific rights: Windows defines WRITE_DAC for modifying a DACL, WRITE_OWNER for changing ownership, and DELETE for deleting an object. Access to the auditing SACL requires ACCESS_SYSTEM_SECURITY and the appropriate privilege. These are native Windows security rights, not NCrypt-specific constants. See Standard Access Rights and SACL Access Right. These definitions do not establish every check performed by the corresponding NCrypt calls. For signing, I found no documented Software KSP ACE permission. NCRYPT_ALLOW_SIGNING_FLAG is a key-usage policy flag, not an access-mask bit to pass to AccessCheck.
    3. Read-only verification: I’m not aware of a documented NCrypt API that evaluates an arbitrary token’s authorization for all three operations without performing them. A signature-buffer-size query is documented to return the required size, not to prove signing authorization.
    4. AccessCheck: It can evaluate descriptor grants but requires the appropriate object mapping. Its documented inputs include an impersonation token with TOKEN_QUERY, owner and group SIDs in the descriptor, and a desired-access mask without generic bits. WRITE_DAC and DELETE identify the respective standard-right checks; I cannot provide a documented Software KSP mapping or signing mask. See AccessCheck.

    Even a correctly configured descriptor check would not evaluate separate key-usage or strong-key UI requirements. Your distinction between opening the key, permitted key usage, and effective authorization is therefore appropriate.

    For the supported contract you’re seeking, I'd suggest reporting it through Feedback Hub so it reaches the Windows team directly: 

    1. Press Windows logo key + F (or search for Feedback Hub in Start). 
    2. Search for existing feedback first. If you find a matching report, upvote it and add your details. 
    3. If there isn't one, select Report a problem and choose the category that fits best. 

    If you found my support helpful, I’d really appreciate it if you could follow this guide so others with similar issue can benefit as well.     

    Thank you.   

    Was this answer helpful?


  2. AI answer

    2026-10-25T01:11:57.9166667+00:00

    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_MAPPING for 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, or FILE_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 NCryptSetProperty with NCRYPT_SECURITY_DESCR_PROPERTY and the appropriate SECURITY_INFORMATION flags.^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_DAC necessarily predicts whether NCryptSetProperty will succeed.
    • DELETE necessarily predicts whether NCryptDeleteKey will 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:

    1. Retrieve and validate the descriptor structure, owner, group, DACL protection, ACE types, trustees, and raw masks.
    2. Treat generic bits as unresolved unless Microsoft supplies the Software KSP mapping.
    3. Do not normalize them with file, registry, or another object type’s mapping.
    4. Do not claim non-invasive proof of sign, security-change, or deletion permission from AccessCheck.
    5. 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

    1. Key Storage Property Identifiers
    2. Generic access rights
    3. Key Storage and Retrieval
    4. NCryptSignHash function (ncrypt.h)
    5. NCryptSetProperty function (ncrypt.h)
    6. NCryptDeleteKey function (ncrypt.h)
    7. AccessCheck function (securitybaseapi.h)
    8. Checking Access to Private Objects
    9. AuthzAccessCheck function (authz.h)
    AI-generated content may be incorrect. Read our transparency notes for more information.

    Was this answer helpful?

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.