Source file
src/crypto/x509/root_plan9.go
1
2
3
4
5
6
7 package x509
8
9 import (
10 "os"
11 )
12
13
14 var certFiles = []string{
15 "/sys/lib/tls/ca.pem",
16 }
17
18 func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) {
19 return nil, nil
20 }
21
22 func loadSystemRoots() (*CertPool, error) {
23 roots := NewCertPool()
24 var bestErr error
25 for _, file := range certFiles {
26 data, err := os.ReadFile(file)
27 if err == nil {
28 roots.AppendCertsFromPEM(data)
29 return roots, nil
30 }
31 if bestErr == nil || (os.IsNotExist(bestErr) && !os.IsNotExist(err)) {
32 bestErr = err
33 }
34 }
35 if bestErr == nil {
36 return roots, nil
37 }
38 return nil, bestErr
39 }
40
View as plain text