• Filippo Valsorda's avatar
    crypto/tls: select only compatible chains from Certificates · eb93c684
    Filippo Valsorda authored
    Now that we have a full implementation of the logic to check certificate
    compatibility, we can let applications just list multiple chains in
    Certificates (for example, an RSA and an ECDSA one) and choose the most
    appropriate automatically.
    
    NameToCertificate only maps each name to one chain, so simply deprecate
    it, and while at it simplify its implementation by not stripping
    trailing dots from the SNI (which is specified not to have any, see RFC
    6066, Section 3) and by not supporting multi-level wildcards, which are
    not a thing in the WebPKI (and in crypto/x509).
    
    The performance of SupportsCertificate without Leaf is poor, but doesn't
    affect current users. For now document that, and address it properly in
    the next cycle. See #35504.
    
    While cleaning up the Certificates/GetCertificate/GetConfigForClient
    behavior, also support leaving Certificates/GetCertificate nil if
    GetConfigForClient is set, and send unrecognized_name when there are no
    available certificates.
    
    Fixes #29139
    Fixes #18377
    
    Change-Id: I26604db48806fe4d608388e55da52f34b7ca4566
    Reviewed-on: https://go-review.googlesource.com/c/go/+/205059
    Run-TryBot: Filippo Valsorda <filippo@golang.org>
    TryBot-Result: Gobot Gobot <gobot@golang.org>
    Reviewed-by: default avatarKatie Hockman <katie@golang.org>
    eb93c684
conn_test.go 9.69 KB