【问题标题】:TLS in .NET - Third Party Root CA not recognized as Trusted Root CA.NET 中的 TLS - 第三方根 CA 未被识别为受信任的根 CA
【发布时间】:2019-01-22 04:02:38
【问题描述】:

我正在尝试在我的 .NET 应用程序和我安装了第三方根 CA 证书和中间 CA 证书的网站之间建立 TLS 连接:

ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12 | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls;
var handler = new WebRequestHandler
{
     ClientCertificateOptions = ClientCertificateOption.Manual
};
handler.ClientCertificates.Add(someClientCertificate);
var httpClient = new HttpClient(handler);
httpClient.DefaultRequestHeaders.AcceptCharset.Add(new StringWithQualityHeaderValue("utf-8"));
httpClient.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json"));

var httpResponseMessage = httpClient.GetAsync("https://somewebsite.com").Result;

当我尝试这样做时,我在服务器证书验证期间收到以下错误:

(PartialChain) 无法将证书链构建到受信任的 根权限。

当我将根 CA 证书安装到受信任的根 CA 存储中时,错误消失了。

这种行为的原因是什么?根据我的阅读(参见https://security.stackexchange.com/questions/140211/whats-the-difference-between-trusted-root-certification-authorities-and-thir),我的印象是第三方根 CA 存储基本上只是受信任的根 CA 存储的一个子集,因此应该成功构建链。

请注意,将根 CA 证书安装到受信任的根 CA 存储对我来说不是一个选项。

【问题讨论】:

  • 是添加到 LocalMachine\ThirdPartyRoot 还是 CurrentUser\ThirdPartyRoot?
  • @bartonjs CurrentUser.

标签: .net ssl https certificate tls1.2


【解决方案1】:

由于我从未理解过的原因,CurrentUser\ThirdPartyRoot 存储似乎没有任何功能。至少,它没有以类似于 LocalMachine\ThirdPartyRoot 的方式链接到链构建器信任决策。

http://kreelbits.blogspot.com/2014/02/whats-purpose-of-users-third-party-root.html 有一点自我发现的抱怨,它显示了 CurrentUser\Root 存储的支持实现与 LocalMachine\Root 的结构是如何不同的。由此推断,“Root”(不是“ThirdPartyRoot”)存储是唯一实际用于信任决策的存储(LM\ThirdPartyRoot 通过存储链接包含在内)。

【讨论】:

  • 这太令人沮丧而且不明显。这可能是 Windows 错误而不是故意的吗?
猜你喜欢
  • 2021-07-17
  • 1970-01-01
  • 1970-01-01
  • 2011-04-16
  • 1970-01-01
  • 2016-04-28
  • 1970-01-01
  • 2016-12-22
  • 1970-01-01
相关资源
最近更新 更多