MCPcopy Create free account
hub / github.com/SenseUnit/dumbproxy / LoadCAfile

Function LoadCAfile

tlsutil/util.go:30–40  ·  view source on GitHub ↗
(filename string)

Source from the content-addressed store, hash-verified

28}
29
30func LoadCAfile(filename string) (*x509.CertPool, error) {
31 roots := x509.NewCertPool()
32 pem, err := os.ReadFile(filename)
33 if err != nil {
34 return nil, fmt.Errorf("unable to load CA PEM from file %q: %w", filename, err)
35 }
36 if ok := roots.AppendCertsFromPEM(pem); !ok {
37 return nil, fmt.Errorf("no certificates were read from CA file %q", filename)
38 }
39 return roots, nil
40}
41
42var (
43 cipherNameToID map[string]uint16

Callers 2

makeServerTLSConfigFunction · 0.92
TLSConfigFromURLFunction · 0.85

Calls 1

ErrorfMethod · 0.80

Tested by

no test coverage detected