-
Notifications
You must be signed in to change notification settings - Fork 4.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
certificates added to user CertificateAuthority store are ignored by X509Chain.Build on macOS #48207
Comments
Tagging subscribers to this area: @bartonjs, @vcsjones, @krwq, @GrabYourPitchforks Issue DetailsThis is subset of #48017 as the underlying issue seems different. using (X509Store store = new X509Store(StoreName.CertificateAuthority, StoreLocation.CurrentUser))
{
// add chain certificate so we can construct chain since there is no way how to pass intermediates directly.
store.Open(OpenFlags.ReadWrite);
store.AddRange(clientChain);
store.Close();
}
var chain = new X509Chain();
....
bool chainStatus = chain.Build(clientCertificate); It works on Linux & Windows but it fails consistently on macOS (10.15) It seems like that store does not have standard OS KeyChain mapping and that is reason why the chain does not build correctly. If that is true, it would be nice if we can feed reference to the keychain or it's collection automaticaly so validation and chain building works consistently across platforms.
|
Only My, Root (RO), and Disallowed stores work on macOS. The call to store.Open should be throwing: Lines 102 to 136 in 1e5ec5c
|
@bartonjs For Line 115 in 1e5ec5c
That said, macOS has no notion of a |
It seems like it was originally not supported for 2.x, and in 3.0 this PR landed: dotnet/corefx#30603 which added support for custom trust stores, likely to support arbitrary store names for |
Ah, yep. Missed that the first case block has a fallback return in it. Seems like the three paths are:
The last one is the most compatible, I suppose. Maybe there's a cheaper way to implement it (e.g. maybe the chain building API supports "and uh, also use this keychain as part of resolving" and we can pass the keychain handle. Or at least pass the keychain handle to our shim API so we can avoid the O(N) P/Invokes in building the array) |
It feels like last option would give most consistent experience. Since the stores probably don't change too frequently and are probably reasonably small, I'm wondering if we can pre-compute the list so it can be added in O(1). |
This is subset of #48017 as the underlying issue seems different.
I basically have fragment like
It works on Linux & Windows but it fails consistently on macOS (10.15)
Interestingly, it works if I use
StoreName.My
instead.It seems like that store does not have standard OS KeyChain mapping and that is reason why the chain does not build correctly. If that is true, it would be nice if we can feed reference to the keychain or it's collection automaticaly so validation and chain building works consistently across platforms.
In SslStream this primarily impacts cases with client certificates.
The text was updated successfully, but these errors were encountered: