crypto/tls: add client-side SNI support and PeerCertificates.

SNI (Server Name Indication) is a way for a TLS client to
indicate to the server which name it knows the server by. This
allows the server to have several names and return the correct
certificate for each (virtual hosting).

PeerCertificates returns the list of certificates presented by
server.

R=r
CC=golang-dev
https://golang.org/cl/1741053
This commit is contained in:
Adam Langley 2010-07-21 11:36:01 -04:00
parent 8286ee4c5b
commit 7be849d4a6
4 changed files with 19 additions and 1 deletions

View file

@ -28,6 +28,7 @@ func (c *Conn) clientHandshake() os.Error {
compressionMethods: []uint8{compressionNone},
random: make([]byte, 32),
ocspStapling: true,
serverName: c.config.ServerName,
}
t := uint32(c.config.Time())
@ -107,6 +108,8 @@ func (c *Conn) clientHandshake() os.Error {
return c.sendAlert(alertUnsupportedCertificate)
}
c.peerCertificates = certs
if serverHello.certStatus {
msg, err = c.readHandshake()
if err != nil {