v1.1.11 Latest Latest

This package is not in the latest version of its module.

Go to latest
Published: Mar 9, 2023 License: Apache-2.0 Imports: 7 Imported by: 0




This section is empty.


This section is empty.


func AppendCertificate

func AppendCertificate(ca []byte) (*x509.CertPool, error)

AppendCertificate appends an in-memory PEM-encoded certificate or bundle and returns a pool.

func ConfigureTLS

func ConfigureTLS(t *tls.Config, c *Config) error

ConfigureTLS sets up the RootCAs on the provided tls.Config based on the Config specified.

func LoadCACerts

func LoadCACerts(c *Config) (*x509.CertPool, error)

LoadCACerts loads a CertPool based on the Config specified.

func LoadCAFile

func LoadCAFile(caFile string) (*x509.CertPool, error)

LoadCAFile loads a single PEM-encoded file from the path specified.

func LoadCAPath

func LoadCAPath(caPath string) (*x509.CertPool, error)

LoadCAPath walks the provided path and loads all certificates encounted into a pool.

func LoadSystemCAs

func LoadSystemCAs() (*x509.CertPool, error)

LoadSystemCAs does nothing on non-Darwin systems. We return nil so that default behavior of standard TLS config libraries is triggered, which is to load system certs.


type Config

type Config struct {
	// CAFile is a path to a PEM-encoded certificate file or bundle. Takes
	// precedence over CACertificate and CAPath.
	CAFile string

	// CACertificate is a PEM-encoded certificate or bundle. Takes precedence
	// over CAPath.
	CACertificate []byte

	// CAPath is a path to a directory populated with PEM-encoded certificates.
	CAPath string

Config determines where LoadCACerts will load certificates from. When CAFile, CACertificate and CAPath are blank, this library's functions will either load system roots explicitly and return them, or set the CertPool to nil to allow Go's standard library to load system certs.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL