github.com/shijuvar/go@v0.0.0-20141209052335-e8f13700b70c/src/crypto/x509/root_darwin.go (about)

     1  // Copyright 2013 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  package x509
     6  
     7  import "os/exec"
     8  
     9  func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) {
    10  	return nil, nil
    11  }
    12  
    13  func execSecurityRoots() (*CertPool, error) {
    14  	cmd := exec.Command("/usr/bin/security", "find-certificate", "-a", "-p", "/System/Library/Keychains/SystemRootCertificates.keychain")
    15  	data, err := cmd.Output()
    16  	if err != nil {
    17  		return nil, err
    18  	}
    19  
    20  	roots := NewCertPool()
    21  	roots.AppendCertsFromPEM(data)
    22  	return roots, nil
    23  }