MCPcopy
hub / github.com/grpc/grpc-go / readTrustCert

Function readTrustCert

security/advancedtls/internal/testutils/testutils.go:70–80  ·  view source on GitHub ↗
(fileName string)

Source from the content-addressed store, hash-verified

68}
69
70func readTrustCert(fileName string) (*x509.CertPool, error) {
71 trustData, err := os.ReadFile(fileName)
72 if err != nil {
73 return nil, err
74 }
75 trustPool := x509.NewCertPool()
76 if !trustPool.AppendCertsFromPEM(trustData) {
77 return nil, fmt.Errorf("error loading trust certificates")
78 }
79 return trustPool, nil
80}
81
82// LoadCerts function is used to load test certificates at the beginning of
83// each integration test.

Callers 1

LoadCertsMethod · 0.85

Calls 1

ErrorfMethod · 0.65

Tested by

no test coverage detected