您从RFC 5280 (第 4.2.1.10 节)引用的部分不是关于客户端在连接到服务器时应验证的内容的主机名匹配,而是关于如果 CA 使用名称约束时允许发布的内容扩大。
您看到的内容过去是特定于协议的,并在RFC 2818(第 3.1 节)中为 HTTPS 定义。
RFC 6125较新,并且在应用程序协议中协调了这一点。(它不一定被广泛实施。)
更具体地说,www.foo.com
将不匹配foo.com
or .foo.com
:
6.4.1. Checking of Traditional Domain Names
If the DNS domain name portion of a reference identifier is a
"traditional domain name", then matching of the reference identifier
against the presented identifier is performed by comparing the set of
domain name labels using a case-insensitive ASCII comparison, as
clarified by [DNS-CASE] (e.g., "WWW.Example.Com" would be lower-cased
to "www.example.com" for comparison purposes). Each label MUST match
in order for the names to be considered to match, except as
supplemented by the rule about checking of wildcard labels
(Section 6.4.3).
通常,如果您希望证书对www.foo.com
和有效foo.com
,则它需要具有多个主题备用名称(甚至foo.com
不在 涵盖范围内*.foo.com
)。