Skip to content

Allow X509Chain to replace the root trust list for a single call #20302

@bartonjs

Description

@bartonjs

We should add members on the ChainPolicy to allow a single call to X509Chain.Build to consider an X509Certificate2Collection of certs as a replacement of the system/user default certificate trust.

Win32: CERT_CHAIN_ENGINE_CONFIG looks like it has hExclusiveRoot for "replace".

Unix/OpenSSL: We just need to replace the root trust list when deciding whether or not to set the UnknownRoot flag.

Apple/Security.framework: The SecTrust APIs have options to replace the anchors list for a single request.

API requirements:

  • A way of providing the replacement root certificate trust collection, with a clear mode of if the request is using system trust or custom trust.

(edited to remove the option of "in addition to" the system trust due to increased complexity and less OS support)

namespace System.Security.Cryptography.X509Certificates
{
    public enum X509ChainTrustMode
    {
        System,
        CustomRootTrust,
    }

    public partial class X509ChainPolicy
    {
        public X509ChainTrustMode TrustMode { get; set; }
        public X509Certificate2Collection CustomTrustStore { get; }
    }
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    api-approvedAPI was approved in API review, it can be implementedarea-System.Securityhelp wanted[up-for-grabs] Good issue for external contributors

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions