gpt4 book ai didi

.net - 默认证书验证程序

转载 作者:太空宇宙 更新时间:2023-11-03 14:16:38 26 4
gpt4 key购买 nike

有人可以提供有关 .NET 框架如何验证域证书的描述或(最好)引用吗?

我正在尝试连接到配置有具有证书传输安全性的 BasicHttpBinding 的 WCF 服务。服务在机器 1 上,客户端在机器 2 上。两台机器都加入了一个域。服务证书由域的证书颁发机构颁发。但是,当客户端(在我的例子中是 Visual Studio 添加服务引用向导)正在与服务协商时,它会弹出一条警告消息,其中包含证书不受信任的三个可能原因:

  1. 公司颁发的安全证书不在不信任列表中。它可能是值得信赖的。
  2. 安全证书日期有效。
  3. 主机“管理员”的安全证书与您尝试查看的页面名称不匹配。 (警告!!)

但我问的是原因 1,为什么?

另一方面,如果我使用 WcfTestClient,它会弹出以下错误:

URI: https://ip:port/svc   
Metadata contains a reference that cannot be resolved: 'https://ip:port/svc'.
Could not establish trust relationship for the SSL/TLS secure channel with authority 'ip:port'.
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
The remote certificate is invalid according to the validation procedure.HTTP GET Error.

URI: https://ip:port/svc
There was an error downloading 'https://ip:port/svc'.
The underlying connection was closed: Could not establish trust relationship for the SSL/TLS secure channel.
The remote certificate is invalid according to the validation procedure.

有人可以告诉我这里发生了什么吗?如何验证服务证书?拜托,不要让我写一个 PermissivePolicy 来覆盖默认过程?

最佳答案

您在这里进行了两次检查:

  1. 证书“主题”或“别名”字段必须与主机名匹配
  2. 必须将证书(或原始证书,如果是自签名证书)的颁发者添加到客户端计算机上的“根”证书库中

修复此错误很简单 - 只需使用正确的主机名重新颁发证书并将所需的部分添加到对等方的“根”存储区即可。

关于.net - 默认证书验证程序,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18692606/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com