2014-09-21 17:33:12 +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.
|
|
|
|
|
|
|
|
// +build plan9
|
|
|
|
|
|
|
|
package x509
|
|
|
|
|
2017-10-07 00:16:47 +00:00
|
|
|
import (
|
|
|
|
"io/ioutil"
|
|
|
|
"os"
|
|
|
|
)
|
2014-09-21 17:33:12 +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
|
|
|
|
}
|
|
|
|
|
2017-10-07 00:16:47 +00:00
|
|
|
func loadSystemRoots() (*CertPool, error) {
|
2014-09-21 17:33:12 +00:00
|
|
|
roots := NewCertPool()
|
2017-10-07 00:16:47 +00:00
|
|
|
var bestErr error
|
2014-09-21 17:33:12 +00:00
|
|
|
for _, file := range certFiles {
|
|
|
|
data, err := ioutil.ReadFile(file)
|
|
|
|
if err == nil {
|
|
|
|
roots.AppendCertsFromPEM(data)
|
2017-10-07 00:16:47 +00:00
|
|
|
return roots, nil
|
|
|
|
}
|
|
|
|
if bestErr == nil || (os.IsNotExist(bestErr) && !os.IsNotExist(err)) {
|
|
|
|
bestErr = err
|
2014-09-21 17:33:12 +00:00
|
|
|
}
|
|
|
|
}
|
2019-06-02 15:48:37 +00:00
|
|
|
if bestErr == nil {
|
|
|
|
return roots, nil
|
|
|
|
}
|
2017-10-07 00:16:47 +00:00
|
|
|
return nil, bestErr
|
2014-09-21 17:33:12 +00:00
|
|
|
}
|