{"action":"created","issue":{"url":"https://api.github.com/repos/dotnet/corefx/issues/27405","repository_url":"https://api.github.com/repos/dotnet/corefx","labels_url":"https://api.github.com/repos/dotnet/corefx/issues/27405/labels{/name}","comments_url":"https://api.github.com/repos/dotnet/corefx/issues/27405/comments","events_url":"https://api.github.com/repos/dotnet/corefx/issues/27405/events","html_url":"https://github.com/dotnet/corefx/issues/27405","id":299683232,"number":27405,"title":"X509Certificate2Collection.Find() does not return the same certificates as full framework","user":{"login":"gingters","id":755148,"avatar_url":"https://avatars2.githubusercontent.com/u/755148?v=4","gravatar_id":"","url":"https://api.github.com/users/gingters","html_url":"https://github.com/gingters","followers_url":"https://api.github.com/users/gingters/followers","following_url":"https://api.github.com/users/gingters/following{/other_user}","gists_url":"https://api.github.com/users/gingters/gists{/gist_id}","starred_url":"https://api.github.com/users/gingters/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/gingters/subscriptions","organizations_url":"https://api.github.com/users/gingters/orgs","repos_url":"https://api.github.com/users/gingters/repos","events_url":"https://api.github.com/users/gingters/events{/privacy}","received_events_url":"https://api.github.com/users/gingters/received_events","type":"User","site_admin":false},"labels":[{"id":163633782,"url":"https://api.github.com/repos/dotnet/corefx/labels/area-System.Security","name":"area-System.Security","color":"d4c5f9","default":false}],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2018-02-23T11:35:16Z","updated_at":"2018-02-27T17:48:54Z","closed_at":null,"author_association":"NONE","body":"Hi,\r\n\r\nI have a strange issue with handling of certificates from the windows certificate store. On full .NET framework, this code returns the expected certificates, on dotnet core, the very same code does not return any certificates from the store.\r\n\r\nThe code is the following:\r\n\r\n```\r\nvar certificates = new List<X509Certificate2>();\r\n\r\nusing (var myStore = new X509Store(StoreName.My, StoreLocation.CurrentUser))\r\n{\r\n\tmyStore.Open(OpenFlags.ReadOnly);\r\n\tvar certsWithCorrectUsage = myStore.Certificates.Find(X509FindType.FindByKeyUsage, X509KeyUsageFlags.DataEncipherment.ToString(), true);\r\n\r\n\tforeach (var cert in certsWithCorrectUsage)\r\n\t{\r\n\t\tif (cert.HasPrivateKey)\r\n\t\t{\r\n\t\t\tcertificates.Add(cert);\r\n\t\t}\r\n\t}\r\n}\r\n\r\nreturn certificates;\r\n```\r\n\r\nWhen debugging into the `.Find()` method I get down into `FindPal.VerifyCertificateIgnoringErrors()`, and there on the `chainPal.ChainStatus` I see the following error messages:\r\n```\r\nThe signature of the certificate cannot be verified.\r\nA certificate chain processed, but terminated in a root certificate which is not trusted by the tust provider.\r\n```\r\n\r\nI used the following powershell script to generate a root certificate, install it in the Trusted Root Certification Authorities, and create two other test certificates which are signed by this root cert:\r\n\r\n[createcerts.ps1.txt](https://github.com/dotnet/corefx/files/1751455/createcerts.ps1.txt)\r\n\r\nWhy doesn't the code on dotnet core find the root certificate, while it obviously seems to be trusted by my machine and also the full framework finds these certificates as valid for the requested purpose."},"comment":{"url":"https://api.github.com/repos/dotnet/corefx/issues/comments/368965480","html_url":"https://github.com/dotnet/corefx/issues/27405#issuecomment-368965480","issue_url":"https://api.github.com/repos/dotnet/corefx/issues/27405","id":368965480,"user":{"login":"bartonjs","id":10642668,"avatar_url":"https://avatars3.githubusercontent.com/u/10642668?v=4","gravatar_id":"","url":"https://api.github.com/users/bartonjs","html_url":"https://github.com/bartonjs","followers_url":"https://api.github.com/users/bartonjs/followers","following_url":"https://api.github.com/users/bartonjs/following{/other_user}","gists_url":"https://api.github.com/users/bartonjs/gists{/gist_id}","starred_url":"https://api.github.com/users/bartonjs/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bartonjs/subscriptions","organizations_url":"https://api.github.com/users/bartonjs/orgs","repos_url":"https://api.github.com/users/bartonjs/repos","events_url":"https://api.github.com/users/bartonjs/events{/privacy}","received_events_url":"https://api.github.com/users/bartonjs/received_events","type":"User","site_admin":false},"created_at":"2018-02-27T17:48:54Z","updated_at":"2018-02-27T17:48:54Z","author_association":"MEMBER","body":"Like 30 \"are you sure?\" popups later, I've confirmed that it's just flipping that boolean."}}
{"actor":{"display_login":"bartonjs"}}