Fix certificate validation.
asn1: add support for T61String because this is the string type which several www.google.com certificates are now using for fields like CommonName tls: force a handshake in Dial so that certificates are ready afterwards. Fixes #1114. R=rsc CC=golang-dev https://golang.org/cl/2216043
This commit is contained in:
parent
657e8dab30
commit
ed8da7bff6
10
conn.go
10
conn.go
@ -675,5 +675,13 @@ func (c *Conn) PeerCertificates() []*x509.Certificate {
|
||||
// connecting to host. If so, it returns nil; if not, it returns an os.Error
|
||||
// describing the problem.
|
||||
func (c *Conn) VerifyHostname(host string) os.Error {
|
||||
return c.PeerCertificates()[0].VerifyHostname(host)
|
||||
c.handshakeMutex.Lock()
|
||||
defer c.handshakeMutex.Unlock()
|
||||
if !c.isClient {
|
||||
return os.ErrorString("VerifyHostname called on TLS server connection")
|
||||
}
|
||||
if !c.handshakeComplete {
|
||||
return os.ErrorString("TLS handshake has not yet been performed")
|
||||
}
|
||||
return c.peerCertificates[0].VerifyHostname(host)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user