mirror of
https://github.com/golang/go.git
synced 2025-12-08 06:10:04 +00:00
crypto/tls: simplify intermediate certificate handling
The certificates argument to verifyServerCertificate must contain at least one certificate. Simplify the intermediate certificate handling code accordingly. Change-Id: I8292cdfb51f418e011d6d97f47d10b4e631aa932 Reviewed-on: https://go-review.googlesource.com/c/go/+/169657 Reviewed-by: Filippo Valsorda <filippo@golang.org>
This commit is contained in:
parent
2d68380713
commit
20389553c7
1 changed files with 1 additions and 5 deletions
|
|
@ -826,11 +826,7 @@ func (c *Conn) verifyServerCertificate(certificates [][]byte) error {
|
|||
DNSName: c.config.ServerName,
|
||||
Intermediates: x509.NewCertPool(),
|
||||
}
|
||||
|
||||
for i, cert := range certs {
|
||||
if i == 0 {
|
||||
continue
|
||||
}
|
||||
for _, cert := range certs[1:] {
|
||||
opts.Intermediates.AddCert(cert)
|
||||
}
|
||||
var err error
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue