go - Golang https server passing certFile and kyeFile in terms of byte array -
func listenandservetls(addr string, certfile string, keyfile string, handler handler) error
above function call start https server in golang. works without problem. however, have more deployments, don't want put key files everywhere. thinking let program download key file , cert file centralized place. if there similar function receiving []byte
opposed string
, easy me that. seems don't see such function in documentations.
looking at source of listenandservetls
seems there no option, calls tls.loadx509keypair
. that's unfortunate; possibly worth submitting feature request.
in meantime, listenandservetls
method not large, , (other tcpkeepalivelistener
) not use non-exported it'd simple copy body of method own function , replace load509keypair
tls.x509keypair
, take []byte
of pem encoded data rather filenames. (or perhaps take tls.certificate
argument instead.)
e.g. something https://play.golang.org/p/ui_8ds8ouu
Comments
Post a Comment