ssl - TLS 握手 "certificate"消息中的多个证书

标签 ssl ssl-certificate x509certificate

我的任务是从 HTTPS 消息中解析服务器名称。我被要求从“client hello”扩展以及“certicate”、“commonname”字段中解析它。

“证书”消息中有多个证书。例如,当使用 https 打开 google 并通过 wireshark 收听时,我看到 2 个证书第一个具有通用名“*.google.com”,第二个具有通用名“Google internet authority”。第一个是我连接的服务器名称,第二个是签署证书的机构。

我的问题是我能否确定服务器名称(在我的例子中是 google.com)将始终出现在第一条证书消息中。如果我只想获取服务器名,是否需要关心证书消息中的其他证书。

最佳答案

事实上,rfc 2246、4346 和 5246(分别是 TLS 1.0、TLS 1.1 和 TLS 1.2)都声明服务器证书应该是第一个:

"This is a sequence (chain) of X.509v3 certificates. The sender's certificate must come first in the list. Each following certificate must directly certify the one preceding it."

在 SSL 3.0 中也很清楚:

" certificate_list: This is a sequence (chain) of X.509.v3
certificates, ordered with the sender's certificate first followed
by any certificate authority certificates proceeding sequentially
upward."

但在现实世界中,有很多配置错误的服务器以任意顺序发送证书,因此您将不得不重新排序,抱歉。

关于ssl - TLS 握手 "certificate"消息中的多个证书,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15829040/

相关文章:

node.js - 无法让 SSL 与 NodeJS 一起工作

ruby-on-rails - Rails - SSL 不适用于裸域

Java X509证书颁发者验证

encoding - 如何使用 BER 编码对象 System.DirectoryServices.Protocols.BerConverter.Encode ("???", myData)

ssl - 无法初始化类 io.netty.handler.time out.IdleStateEvent

javascript - 使用 SSL 运行的应用程序在第一次访问时未加载所有脚本/CSS

c# - 调用 PostAsJsonAsync 时请求被中止 : Could not create SSL/TLS secure channel.

c# - (离线)验证 SSL 连接

amazon-web-services - 二级子域的通配符

asp.net-mvc - 如何在 ASP.NET MVC 中要求 X.509 证书身份验证?