(t testing.TB, c tls.Certificate, certPath, keyPath string)
| 71 | } |
| 72 | |
| 73 | func 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 | } |