From the source:
// Listen creates a TLS listener accepting connections on the
// given network address using net.Listen.
// The configuration config must be non-nil and must include
// at least one certificate or else set GetCertificate.
func Listen(network, laddr string, config *Config) (net.Listener, error) {
if config == nil || (len(config.Certificates) == 0 && config.GetCertificate == nil) {
return nil, errors.New("tls: neither Certificates nor GetCertificate set in Config")
}
l, err := net.Listen(network, laddr)
if err != nil {
return nil, err
}
return NewListener(l, config), nil
}
The problem is that the certificates cannot be nil:
// The configuration config must be non-nil and must include
// at least one certificate or else set GetCertificate.
How can I use a tls
connection listening without certificates?
What I need is the tls
encryption but not the authentication.
I tried making a tls.Config with an empty certificate like this:
&tls.Config{
Certificates: []tls.Certificate{tls.Certificate{}},
}
But the connections failed with tls: handshake failure
.
Is this even possible?