Microsoft Software KSP: generic access-right mapping for persisted CNG keys and export-policy changes after finalization
We are qualifying a Windows service in an isolated laboratory and need clarification about the documented security contract of the Microsoft Software Key Storage Provider.
Configuration and required policy
- Persisted, machine-scoped ECDSA P-256 key.
-
KeyUsage = Signing. -
ExportPolicy = None. - Service running as LocalService with a restricted, service-specific SID.
- SYSTEM provisions and recovers the key.
The service must be able to open the key, read necessary public metadata and security information, and sign challenges. It must not be able to export private key material, delete the key, change its owner or DACL, or broaden its export policy.
The requested security descriptor is schematically:
O:SYG:SYD:P(A;;GA;;;SY)(A;;GR;;;<SERVICE_SID>)
<SERVICE_SID> is a placeholder for the actual service-specific SID.
Reading back NCRYPT_SECURITY_DESCR_PROPERTY produces:
| Trustee | Requested access mask | Observed access mask |
|---|---|---|
| SYSTEM | 0x10000000 — GENERIC_ALL |
0xD01F01FF |
| -------- | -------- | -------- |
| SYSTEM | 0x10000000 — GENERIC_ALL |
0xD01F01FF |
| Service-specific SID | 0x80000000 — GENERIC_READ |
0x80120089 |
The owner and primary group remain SYSTEM. The DACL remains protected and contains exactly two access-allowed ACEs, in the expected order, with no inheritance or additional trustees.
An independent reference experiment reproduced this representation. However, reproducibility alone does not establish the meaning of the resulting rights or their equivalence to our required policy.
We do not want to apply a file-object GENERIC_MAPPING, or interpret these masks as FILE_GENERIC_READ or FILE_ALL_ACCESS, merely because some bits resemble file access masks.
Observed behavior
The authorized restricted LocalService process successfully opened the key and signed a challenge. The signature was independently verified.
Attempts to change the DACL, change the owner, and delete the disposable key were explicitly refused.
Private-key export attempts returned NTE_NOT_SUPPORTED (0x80090029). The export policy remained None. We have retained the distinction between an unsupported operation and an explicit access-control refusal; we do not classify this error automatically as “access denied.”
Export-policy test limitation
A separate test called NCryptSetProperty on a reopened, finalized key handle, setting NCRYPT_EXPORT_POLICY_PROPERTY to NCRYPT_ALLOW_ARCHIVING_FLAG (0x00000004). It returned NTE_BAD_KEY_STATE (0x8009000B), and the policy remained unchanged.
The Key Storage Property Identifiers documentation limits this archiving policy to the original key handle. Therefore, we do not regard that result as proof of an ACL-based refusal.
Questions
Provider-specific mapping: Where is the Microsoft Software KSP’s mapping from GENERIC_ALL and GENERIC_READ to effective key access rights documented? Are the observed masks above a supported normalization of the requested descriptor, and which Windows/provider versions does that behavior cover?
Operation-specific authorization: Which rights govern opening a persisted key, reading its properties or security descriptor, signing, deleting the key, changing its owner/DACL, and changing its export policy? In particular, does the observed service mask grant any operation prohibited by our policy?
Descriptor validation: What supported method should an application use to validate the effective policy after readback, without requiring binary equality with generic ACE masks and without inventing an object-specific GENERIC_MAPPING?
Export-policy mutability: For a persisted ECDSA P-256 key finalized with export policy zero, can a reopened handle validly enable NCRYPT_ALLOW_EXPORT_FLAG or NCRYPT_ALLOW_PLAINTEXT_EXPORT_FLAG? If so, what lifecycle conditions, flags and access rights govern that operation? If not, where is the applicable immutability guarantee documented?
Valid negative test: Is there a documented, valid export-policy modification on a reopened key that can test the service’s lack of authorization, independently of invalid key-state restrictions? If no such operation exists, what documented guarantee should replace that test?
We would appreciate authoritative documentation or clarification from the relevant Windows/CNG team. Until these points are established, our validator continues to reject the unqualified descriptor representation.We are qualifying a Windows service in an isolated laboratory and need clarification about the documented security contract of the Microsoft Software Key Storage Provider.
Configuration and required policy
- Persisted, machine-scoped ECDSA P-256 key.
-
KeyUsage = Signing. -
ExportPolicy = None. - Service running as LocalService with a restricted, service-specific SID.
- SYSTEM provisions and recovers the key.
The service must be able to open the key, read necessary public metadata and security information, and sign challenges. It must not be able to export private key material, delete the key, change its owner or DACL, or broaden its export policy.
The requested security descriptor is schematically:
O:SYG:SYD:P(A;;GA;;;SY)(A;;GR;;;<SERVICE_SID>)
<SERVICE_SID> is a placeholder for the actual service-specific SID.
Reading back NCRYPT_SECURITY_DESCR_PROPERTY produces:
| Trustee | Requested access mask | Observed access mask |
|---|---|---|
| SYSTEM | 0x10000000 — GENERIC_ALL |
0xD01F01FF |
| Service-specific SID | 0x80000000 — GENERIC_READ |
0x80120089 |
The owner and primary group remain SYSTEM. The DACL remains protected and contains exactly two access-allowed ACEs, in the expected order, with no inheritance or additional trustees.
An independent reference experiment reproduced this representation. However, reproducibility alone does not establish the meaning of the resulting rights or their equivalence to our required policy.
We do not want to apply a file-object GENERIC_MAPPING, or interpret these masks as FILE_GENERIC_READ or FILE_ALL_ACCESS, merely because some bits resemble file access masks.
Observed behavior
The authorized restricted LocalService process successfully opened the key and signed a challenge. The signature was independently verified.
Attempts to change the DACL, change the owner, and delete the disposable key were explicitly refused.
Private-key export attempts returned NTE_NOT_SUPPORTED (0x80090029). The export policy remained None. We have retained the distinction between an unsupported operation and an explicit access-control refusal; we do not classify this error automatically as “access denied.”
Export-policy test limitation
A separate test called NCryptSetProperty on a reopened, finalized key handle, setting NCRYPT_EXPORT_POLICY_PROPERTY to NCRYPT_ALLOW_ARCHIVING_FLAG (0x00000004). It returned NTE_BAD_KEY_STATE (0x8009000B), and the policy remained unchanged.
The Key Storage Property Identifiers documentation limits this archiving policy to the original key handle. Therefore, we do not regard that result as proof of an ACL-based refusal.
Questions
Provider-specific mapping: Where is the Microsoft Software KSP’s mapping from GENERIC_ALL and GENERIC_READ to effective key access rights documented? Are the observed masks above a supported normalization of the requested descriptor, and which Windows/provider versions does that behavior cover?
Operation-specific authorization: Which rights govern opening a persisted key, reading its properties or security descriptor, signing, deleting the key, changing its owner/DACL, and changing its export policy? In particular, does the observed service mask grant any operation prohibited by our policy?
Descriptor validation: What supported method should an application use to validate the effective policy after readback, without requiring binary equality with generic ACE masks and without inventing an object-specific GENERIC_MAPPING?
Export-policy mutability: For a persisted ECDSA P-256 key finalized with export policy zero, can a reopened handle validly enable NCRYPT_ALLOW_EXPORT_FLAG or NCRYPT_ALLOW_PLAINTEXT_EXPORT_FLAG? If so, what lifecycle conditions, flags and access rights govern that operation? If not, where is the applicable immutability guarantee documented?
Valid negative test: Is there a documented, valid export-policy modification on a reopened key that can test the service’s lack of authorization, independently of invalid key-state restrictions? If no such operation exists, what documented guarantee should replace that test?
We would appreciate authoritative documentation or clarification from the relevant Windows/CNG team. Until these points are established, our validator continues to reject the unqualified descriptor representation.