David K. Bainbridge | 215e024 | 2017-09-05 23:18:24 -0700 | [diff] [blame] | 1 | // +build go1.7 |
2 | |||||
3 | package tlsconfig | ||||
4 | |||||
5 | import ( | ||||
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. | ||||
12 | func 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 | } |