root_plan9.go 800 B

1234567891011121314151617181920212223242526272829303132333435363738
  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. // +build plan9
  5. package x509
  6. import (
  7. "io/ioutil"
  8. "os"
  9. )
  10. // Possible certificate files; stop after finding one.
  11. var certFiles = []string{
  12. "/sys/lib/tls/ca.pem",
  13. }
  14. func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) {
  15. return nil, nil
  16. }
  17. func loadSystemRoots() (*CertPool, error) {
  18. roots := NewCertPool()
  19. var bestErr error
  20. for _, file := range certFiles {
  21. data, err := ioutil.ReadFile(file)
  22. if err == nil {
  23. roots.AppendCertsFromPEM(data)
  24. return roots, nil
  25. }
  26. if bestErr == nil || (os.IsNotExist(bestErr) && !os.IsNotExist(err)) {
  27. bestErr = err
  28. }
  29. }
  30. return nil, bestErr
  31. }