MCPcopy Create free account
hub / github.com/TheThingsNetwork/lorawan-stack / AppendRootCAsToContext

Function AppendRootCAsToContext

pkg/auth/mtls/context.go:64–73  ·  view source on GitHub ↗

AppendRootCAsToContext appends the given PEM encoded Root Certificates to the root CAs in the context.

(parent context.Context, pem []byte)

Source from the content-addressed store, hash-verified

62
63// AppendRootCAsToContext appends the given PEM encoded Root Certificates to the root CAs in the context.
64func AppendRootCAsToContext(parent context.Context, pem []byte) context.Context {
65 certPool := RootCAsFromContext(parent)
66 if certPool != nil {
67 certPool = certPool.Clone()
68 } else {
69 certPool = x509.NewCertPool()
70 }
71 certPool.AppendCertsFromPEM(pem)
72 return context.WithValue(parent, rootCAsKey, certPool)
73}

Callers 2

TestTLSCertVerificationFunction · 0.92
authenticateMethod · 0.92

Calls 2

RootCAsFromContextFunction · 0.85
CloneMethod · 0.45

Tested by 1

TestTLSCertVerificationFunction · 0.74