root_plan9.go 675 B

1234567891011121314151617181920212223242526272829303132
  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. //go:build plan9
  5. // +build plan9
  6. package system
  7. import (
  8. "crypto/x509"
  9. )
  10. // Possible certificate files; stop after finding one.
  11. var certFiles = []string{
  12. "/sys/lib/tls/ca.pem",
  13. }
  14. func initSystemRoots() (roots []*x509.Certificate) {
  15. for _, file := range certFiles {
  16. data, err := os.ReadFile(file)
  17. if err == nil {
  18. roots, _ = appendPEM(roots, data)
  19. return
  20. }
  21. }
  22. // All of the files failed to load. systemRoots will be nil which will
  23. // trigger a specific error at verification time.
  24. return nil
  25. }