github.com/d4l3k/go@v0.0.0-20151015000803-65fc379daeda/src/crypto/x509/root_plan9.go (about)

     1  // Copyright 2012 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 plan9
     6  
     7  package x509
     8  
     9  import "io/ioutil"
    10  
    11  // Possible certificate files; stop after finding one.
    12  var certFiles = []string{
    13  	"/sys/lib/tls/ca.pem",
    14  }
    15  
    16  func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) {
    17  	return nil, nil
    18  }
    19  
    20  func initSystemRoots() {
    21  	roots := NewCertPool()
    22  	for _, file := range certFiles {
    23  		data, err := ioutil.ReadFile(file)
    24  		if err == nil {
    25  			roots.AppendCertsFromPEM(data)
    26  			systemRoots = roots
    27  			return
    28  		}
    29  	}
    30  
    31  	// All of the files failed to load. systemRoots will be nil which will
    32  	// trigger a specific error at verification time.
    33  }