Skip to content

Trust your CA in Go

Richard Crowley edited this page Apr 13, 2014 · 2 revisions
certPool := x509.NewCertPool()
buf, err := ioutil.ReadFile("etc/ssl/certs/root-ca.crt")
if err != nil {
    return err
}
certPool.AppendCertsFromPEM(buf)
tlsConfig := &tls.Config{RootCAs: certPool}