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