func KeyToPEM(cert *tls.Certificate) []byte {
	switch k := cert.PrivateKey.(type) {
	case *rsa.PrivateKey:
		return pem.EncodeToMemory(&pem.Block{
			Type:  "RSA PRIVATE KEY",
			Bytes: x509.MarshalPKCS1PrivateKey(k),
		})
	default:
		return nil
	}
}
func KeyToPEM(cert *tls.Certificate) []byte {
	switch k := cert.PrivateKey.(type) {
	case *rsa.PrivateKey:
		return pem.EncodeToMemory(&pem.Block{
			Type:  "RSA PRIVATE KEY",
			Bytes: x509.MarshalPKCS1PrivateKey(k),
		})
	default:
		return nil
	}
}
// KeyToPEM serializes the private key in 'cert' to a PEM-formatted block if
// it's an RSA key, or nil otherwise (all certs returned by
// GenerateSelfSignedCert use RSA keys)