func loadKeyMaterials() (*KeyMaterial, error) {
	certs, err := tls.LoadX509KeyPair(testdata.Path("server1.pem"), testdata.Path("server1.key"))
	if err != nil {
		return nil, err
	}

	pemData, err := ioutil.ReadFile(testdata.Path("ca.pem"))
	if err != nil {
		return nil, err
	}
	roots := x509.NewCertPool()
	roots.AppendCertsFromPEM(pemData)
	return &KeyMaterial{Certs: []tls.Certificate{certs}, Roots: roots}, nil
}
// loadKeyMaterials is a helper to read cert/key files from testdata and convert
// them into a KeyMaterial struct.
loadKeyMaterials is a helper to read cert/key files from testdata and convert
them into a KeyMaterial struct.
// loadKeyMaterials is a helper to read cert / key files from testdata and convert // them into a KeyMaterial struct .
func loadKeyMaterials() (*KeyMaterial, error) {
	certs, err := tls.LoadX509KeyPair(testdata.Path("server1.pem"), testdata.Path("server1.key"))
	if err != nil {
		return nil, err
	}
	pemData, err := ioutil.ReadFile(testdata.Path("ca.pem"))
	if err != nil {
		return nil, err
	}
	roots := x509.NewCertPool()
	roots.AppendCertsFromPEM(pemData)
	return &KeyMaterial{Certs: []tls.Certificate{certs}, Roots: roots}, nil
}
func loadKeyMaterials ( ) ( * KeyMaterial , error ) { certs , err := tls . LoadX509KeyPair ( testdata . Path ( " " ) , testdata . Path ( " " ) ) if err != nil { return nil , err } pemData , err := ioutil . ReadFile ( testdata . Path ( " " ) ) if err != nil { return nil , err } roots := x509 . NewCertPool ( ) roots . AppendCertsFromPEM ( pemData ) return & KeyMaterial { Certs : [ ] tls . Certificate { certs } , Roots : roots } , nil }
loadKeyMaterials is a helper to read cert/key files from testdata and convert
them into a KeyMaterial struct.
loadKeyMaterials is a helper to read cert / key files from testdata and convert them into a KeyMaterial struct .