blob: 1ca0965e06ea5549d2cb24356f0e6d406a6371a4 [file] [log] [blame]
David K. Bainbridge215e0242017-09-05 23:18:24 -07001// +build go1.7
2
3package tlsconfig
4
5import (
6 "crypto/x509"
7 "runtime"
8)
9
10// SystemCertPool returns a copy of the system cert pool,
11// returns an error if failed to load or empty pool on windows.
12func SystemCertPool() (*x509.CertPool, error) {
13 certpool, err := x509.SystemCertPool()
14 if err != nil && runtime.GOOS == "windows" {
15 return x509.NewCertPool(), nil
16 }
17 return certpool, err
18}