2012-10-23 04:31:11 +00:00
|
|
|
// Copyright 2012 The Go Authors. All rights reserved.
|
|
|
|
// Use of this source code is governed by a BSD-style
|
|
|
|
// license that can be found in the LICENSE file.
|
|
|
|
|
2021-07-30 14:28:58 -07:00
|
|
|
//go:build plan9
|
2012-10-23 04:31:11 +00:00
|
|
|
|
|
|
|
package x509
|
|
|
|
|
2016-07-22 18:15:38 +00:00
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
)
|
2012-10-23 04:31:11 +00:00
|
|
|
|
|
|
|
// Possible certificate files; stop after finding one.
|
|
|
|
var certFiles = []string{
|
|
|
|
"/sys/lib/tls/ca.pem",
|
|
|
|
}
|
|
|
|
|
|
|
|
func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) {
|
|
|
|
return nil, nil
|
|
|
|
}
|
|
|
|
|
2016-07-22 18:15:38 +00:00
|
|
|
func loadSystemRoots() (*CertPool, error) {
|
2012-10-23 04:31:11 +00:00
|
|
|
roots := NewCertPool()
|
2016-07-22 18:15:38 +00:00
|
|
|
var bestErr error
|
2012-10-23 04:31:11 +00:00
|
|
|
for _, file := range certFiles {
|
2020-12-23 09:57:37 -08:00
|
|
|
data, err := os.ReadFile(file)
|
2012-10-23 04:31:11 +00:00
|
|
|
if err == nil {
|
|
|
|
roots.AppendCertsFromPEM(data)
|
2016-07-22 18:15:38 +00:00
|
|
|
return roots, nil
|
|
|
|
}
|
|
|
|
if bestErr == nil || (os.IsNotExist(bestErr) && !os.IsNotExist(err)) {
|
|
|
|
bestErr = err
|
2012-10-23 04:31:11 +00:00
|
|
|
}
|
|
|
|
}
|
2018-09-24 21:46:21 +00:00
|
|
|
if bestErr == nil {
|
|
|
|
return roots, nil
|
|
|
|
}
|
2016-07-22 18:15:38 +00:00
|
|
|
return nil, bestErr
|
2012-10-23 04:31:11 +00:00
|
|
|
}
|