MCPcopy Create free account
hub / github.com/coder/envbox / WriteCertificate

Function WriteCertificate

integration/integrationtest/certs.go:73–82  ·  view source on GitHub ↗
(t testing.TB, c tls.Certificate, certPath, keyPath string)

Source from the content-addressed store, hash-verified

71}
72
73func WriteCertificate(t testing.TB, c tls.Certificate, certPath, keyPath string) {
74 require.Len(t, c.Certificate, 1, "expecting 1 certificate")
75 key, err := x509.MarshalPKCS8PrivateKey(c.PrivateKey)
76 require.NoError(t, err)
77
78 cert := c.Certificate[0]
79
80 writePEM(t, keyPath, "PRIVATE KEY", key)
81 writePEM(t, certPath, "CERTIFICATE", cert)
82}

Callers 1

TestDockerFunction · 0.92

Calls 2

writePEMFunction · 0.85
LenMethod · 0.80

Tested by 1

TestDockerFunction · 0.74