github.com/d4l3k/go@v0.0.0-20151015000803-65fc379daeda/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  //go:generate go run root_darwin_arm_gen.go -output root_darwin_armx.go
     6  
     7  package x509
     8  
     9  import "os/exec"
    10  
    11  func (c *Certificate) systemVerify(opts *VerifyOptions) (chains [][]*Certificate, err error) {
    12  	return nil, nil
    13  }
    14  
    15  func execSecurityRoots() (*CertPool, error) {
    16  	cmd := exec.Command("/usr/bin/security", "find-certificate", "-a", "-p", "/System/Library/Keychains/SystemRootCertificates.keychain")
    17  	data, err := cmd.Output()
    18  	if err != nil {
    19  		return nil, err
    20  	}
    21  
    22  	roots := NewCertPool()
    23  	roots.AppendCertsFromPEM(data)
    24  	return roots, nil
    25  }