2021-10-12 09:25:53 +08:00
|
|
|
//go:build plan9
|
2021-02-15 20:09:49 +08:00
|
|
|
// +build plan9
|
|
|
|
|
|
|
|
package smx509
|
|
|
|
|
|
|
|
import (
|
|
|
|
"os"
|
|
|
|
)
|
|
|
|
|
|
|
|
// 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
|
|
|
|
}
|
|
|
|
|
|
|
|
func loadSystemRoots() (*CertPool, error) {
|
|
|
|
roots := NewCertPool()
|
|
|
|
var bestErr error
|
|
|
|
for _, file := range certFiles {
|
2021-12-03 15:12:27 +08:00
|
|
|
data, err := os.ReadFile(file)
|
2021-02-15 20:09:49 +08:00
|
|
|
if err == nil {
|
|
|
|
roots.AppendCertsFromPEM(data)
|
|
|
|
return roots, nil
|
|
|
|
}
|
|
|
|
if bestErr == nil || (os.IsNotExist(bestErr) && !os.IsNotExist(err)) {
|
|
|
|
bestErr = err
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if bestErr == nil {
|
|
|
|
return roots, nil
|
|
|
|
}
|
|
|
|
return nil, bestErr
|
|
|
|
}
|