github.com/zmap/zcrypto@v0.0.0-20240512203510-0fef58d9a9db/ct/x509/root_plan9.go (about) 1 // Copyright 2012 The Go Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style 3 // license that can be found in the LICENSE file. 4 5 //go:build plan9 6 // +build plan9 7 8 package x509 9 10 import ( 11 "io/ioutil" 12 "os" 13 ) 14 15 // Possible certificate files; stop after finding one. 16 var certFiles = []string{ 17 "/sys/lib/tls/ca.pem", 18 } 19 20 func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) { 21 return nil, nil 22 } 23 24 func loadSystemRoots() (*CertPool, error) { 25 roots := NewCertPool() 26 var bestErr error 27 for _, file := range certFiles { 28 data, err := ioutil.ReadFile(file) 29 if err == nil { 30 roots.AppendCertsFromPEM(data) 31 return roots, nil 32 } 33 if bestErr == nil || (os.IsNotExist(bestErr) && !os.IsNotExist(err)) { 34 bestErr = err 35 } 36 } 37 return nil, bestErr 38 }