code: func WriteCertFile(outFile afero.File, template *x509.Certificate, pub interface{}, priv interface{}) error {
  	certDER, err := x509.CreateCertificate(rand.Reader, template, template, pub, priv)
  	if err != nil {
  		return err
  	}
  
  	// PEM encode the certificate (this is a standard TLS encoding)
  	b := &pem.Block{
  		Type:  "CERTIFICATE",
  		Bytes: certDER,
  	}
  
  	return pem.Encode(outFile, b)
  }
docs: // WriteCertFile writes the cert.pem certificate file