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

Function makeChain

security/advancedtls/crl_test.go:234–254  ·  view source on GitHub ↗
(t *testing.T, name string)

Source from the content-addressed store, hash-verified

232}
233
234func makeChain(t *testing.T, name string) []*x509.Certificate {
235 t.Helper()
236
237 certChain := make([]*x509.Certificate, 0)
238
239 rest, err := os.ReadFile(name)
240 if err != nil {
241 t.Fatalf("os.ReadFile(%v) failed %v", name, err)
242 }
243 for len(rest) > 0 {
244 var block *pem.Block
245 block, rest = pem.Decode(rest)
246 c, err := x509.ParseCertificate(block.Bytes)
247 if err != nil {
248 t.Fatalf("ParseCertificate error %v", err)
249 }
250 t.Logf("Parsed Cert sub = %v iss = %v", c.Subject, c.Issuer)
251 certChain = append(certChain, c)
252 }
253 return certChain
254}
255
256func loadCRL(t *testing.T, path string) *CRL {
257 crl, err := ReadCRLFile(path)

Callers 5

TestVerifyCrlFunction · 0.85
TestRevokedCertFunction · 0.85
TestStaticCRLProviderMethod · 0.85

Calls 3

FatalfMethod · 0.65
DecodeMethod · 0.65
LogfMethod · 0.65

Tested by

no test coverage detected