src/pkg/crypto/x509/root_unix.go - The Go Programming Language

Golang

Source file src/pkg/crypto/x509/root_unix.go

     1	// Copyright 2011 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	
     5	// +build freebsd linux openbsd netbsd
     6	
     7	package x509
     8	
     9	import "io/ioutil"
    10	
    11	// Possible certificate files; stop after finding one.
    12	var certFiles = []string{
    13		"/etc/ssl/certs/ca-certificates.crt",     // Linux etc
    14		"/etc/pki/tls/certs/ca-bundle.crt",       // Fedora/RHEL
    15		"/etc/ssl/ca-bundle.pem",                 // OpenSUSE
    16		"/etc/ssl/cert.pem",                      // OpenBSD
    17		"/usr/local/share/certs/ca-root-nss.crt", // FreeBSD
    18	}
    19	
    20	func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) {
    21		return nil, nil
    22	}
    23	
    24	func initSystemRoots() {
    25		roots := NewCertPool()
    26		for _, file := range certFiles {
    27			data, err := ioutil.ReadFile(file)
    28			if err == nil {
    29				roots.AppendCertsFromPEM(data)
    30				break
    31			}
    32		}
    33	
    34		systemRoots = roots
    35	}