Retro68/gcc/libgo/go/crypto/x509/root_unix.go

38 lines
1.1 KiB
Go
Raw Normal View History

2012-03-27 23:13:14 +00:00
// Copyright 2011 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.
2014-09-21 17:33:12 +00:00
// +build dragonfly freebsd linux openbsd netbsd
2012-03-27 23:13:14 +00:00
2014-09-21 17:33:12 +00:00
package x509
2012-03-27 23:13:14 +00:00
2014-09-21 17:33:12 +00:00
import "io/ioutil"
2012-03-27 23:13:14 +00:00
// Possible certificate files; stop after finding one.
var certFiles = []string{
2014-09-21 17:33:12 +00:00
"/etc/ssl/certs/ca-certificates.crt", // Debian/Ubuntu/Gentoo etc.
2012-03-27 23:13:14 +00:00
"/etc/pki/tls/certs/ca-bundle.crt", // Fedora/RHEL
"/etc/ssl/ca-bundle.pem", // OpenSUSE
"/etc/ssl/cert.pem", // OpenBSD
2014-09-21 17:33:12 +00:00
"/usr/local/share/certs/ca-root-nss.crt", // FreeBSD/DragonFly
2012-03-27 23:13:14 +00:00
}
2014-09-21 17:33:12 +00:00
func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) {
return nil, nil
}
func initSystemRoots() {
roots := NewCertPool()
2012-03-27 23:13:14 +00:00
for _, file := range certFiles {
data, err := ioutil.ReadFile(file)
if err == nil {
roots.AppendCertsFromPEM(data)
2014-09-21 17:33:12 +00:00
systemRoots = roots
return
2012-03-27 23:13:14 +00:00
}
}
2014-09-21 17:33:12 +00:00
// All of the files failed to load. systemRoots will be nil which will
// trigger a specific error at verification time.
2012-03-27 23:13:14 +00:00
}