MCPcopy Create free account
hub / github.com/cloudfoundry/credhub-cli / CaCerts

Function CaCerts

credhub/options.go:44–69  ·  view source on GitHub ↗

CaCerts specifies the root certificates for HTTPS connections with the CredHub server. If the OAuthStrategy is used for Auth, the root certificates will also be used for HTTPS connections with the OAuth server.

(certs ...string)

Source from the content-addressed store, hash-verified

42// If the OAuthStrategy is used for Auth, the root certificates will also be used for HTTPS
43// connections with the OAuth server.
44func CaCerts(certs ...string) Option {
45 return func(c *CredHub) error {
46 // TODO: remove else block once x509.SystemCertPool is supported on Windows
47 // see: https://github.com/golang/go/issues/16736
48 var pool *x509.CertPool
49 if runtime.GOOS != "windows" {
50 var err error
51 pool, err = x509.SystemCertPool()
52 if err != nil {
53 return err
54 }
55 } else {
56 pool = x509.NewCertPool()
57 }
58 c.caCerts = pool
59
60 for _, cert := range certs {
61 ok := c.caCerts.AppendCertsFromPEM([]byte(cert))
62 if !ok {
63 return errors.New("provided ca certs are invalid")
64 }
65 }
66
67 return nil
68 }
69}
70
71// SkipTLSValidation will skip root certificate verification for HTTPS. Not recommended!
72func SkipTLSValidation(skipTLSvalidation bool) Option {

Callers 9

mainFunction · 0.92
ExampleFunction · 0.92
newCredhubClientFunction · 0.92
GetApiInfoFunction · 0.92
ExecuteMethod · 0.92
RevokeTokenIfNecessaryFunction · 0.92
new_test.goFile · 0.85
client_test.goFile · 0.85

Calls

no outgoing calls

Tested by 1

ExampleFunction · 0.74

Used in the wild real call sites across dependent graphs

searching dependent graphs…