func GetServerCert(cfg *cpb.Config, ca *x509.Certificate, caPriv interface{}) (cert, key []byte, err error) {
	if cfg.ServerCertFile == "" {
		return nil, nil, errors.New("server_cert_file not set")
	}
	if _, err := os.Stat(cfg.ServerCertFile); err != nil {
		if os.IsNotExist(err) {
			if caPriv == nil {
				return nil, nil, errors.New("unable to create server certificate: CA key not loaded")
			}
			if err := makeServerCert(cfg, ca, caPriv); err != nil {
				return nil, nil, err
			}
		} else {
			return nil, nil, fmt.Errorf("unable to stat server_cert_file [%s]: %v", cfg.ServerCertFile, err)
		}
	}
	return getServerCert(cfg)
}
GetServerCert returns the server certificate associated with cfg, creating
it if necessary.  If available, priv is the private key associated with cert.
package certs
import (
	"crypto/ecdsa"
	"crypto/elliptic"
	"crypto/rand"
	"crypto/tls"
	"crypto/x509"
	"crypto/x509/pkix"
	"encoding/pem"
	"errors"
	"fmt"
	"io/ioutil"
	"math/big"
	"net"
	"os"
	"time"
	cpb "github.com/google/fleetspeak/fleetspeak/src/config/proto/fleetspeak_config"
)