github.com/emmansun/gmsm@v0.29.1/smx509/root_plan9.go (about) 1 //go:build plan9 2 3 package smx509 4 5 import ( 6 "os" 7 ) 8 9 // Possible certificate files; stop after finding one. 10 var certFiles = []string{ 11 "/sys/lib/tls/ca.pem", 12 } 13 14 func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) { 15 return nil, nil 16 } 17 18 func loadSystemRoots() (*CertPool, error) { 19 roots := NewCertPool() 20 var bestErr error 21 for _, file := range certFiles { 22 data, err := os.ReadFile(file) 23 if err == nil { 24 roots.AppendCertsFromPEM(data) 25 return roots, nil 26 } 27 if bestErr == nil || (os.IsNotExist(bestErr) && !os.IsNotExist(err)) { 28 bestErr = err 29 } 30 } 31 if bestErr == nil { 32 return roots, nil 33 } 34 return nil, bestErr 35 }