MCPcopy Create free account
hub / github.com/cloudflare/tls-tris / ExampleLoadX509KeyPair

Function ExampleLoadX509KeyPair

example_test.go:165–176  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

163}
164
165func ExampleLoadX509KeyPair() {
166 cert, err := tls.LoadX509KeyPair("testdata/example-cert.pem", "testdata/example-key.pem")
167 if err != nil {
168 log.Fatal(err)
169 }
170 cfg := &tls.Config{Certificates: []tls.Certificate{cert}}
171 listener, err := tls.Listen("tcp", ":2000", cfg)
172 if err != nil {
173 log.Fatal(err)
174 }
175 _ = listener
176}
177
178func ExampleX509KeyPair() {
179 certPem := []byte(`-----BEGIN CERTIFICATE-----

Callers

nothing calls this directly

Calls

no outgoing calls

Tested by

no test coverage detected