rcrowley / go-tigertonic

A Go framework for building JSON web services inspired by Dropwizard

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Convenience for TLS certificates in/around Server

rcrowley opened this issue · comments

This is tedious:

c, err := tls.LoadX509KeyPair(*cert, *key)
if nil != err {
    log.Fatalln(err)
}
certPool := x509.NewCertPool()
buf, err := ioutil.ReadFile(*ca)
if nil != err {
    log.Fatalln(err)
}
certPool.AppendCertsFromPEM(buf)
tlsConfig = &tls.Config{
    Certificates: []tls.Certificate{c},
    CipherSuites: []uint16{tls.TLS_RSA_WITH_RC4_128_SHA},
    RootCAs:      certPool,
}