Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

net/http/server.go: [feature support] Will ListenAndServeTLS(certFile, keyFile string) support []byte parameter for encrypted private key? #39916

Closed
baolinCloud opened this issue Jun 29, 2020 · 2 comments

Comments

@baolinCloud
Copy link

@baolinCloud baolinCloud commented Jun 29, 2020

What version of Go are you using (go version)?

$ go version
1.14.2

Does this issue reproduce with the latest release?

1.14.2

What operating system and processor architecture are you using (go env)?

go env Output
$ go env
amd64/linux

What did you do?

I need to new a https server with encrypted private key file, but ListenAndServeTLS only support filepath parameter.

  1. execute openssl cmd to decrypted the private key file to []byte.
  2. use tls.X509KeyPair to generate certificate.
  3. tls.NewListener

With much work to do which same with the function ListenAndServeTLS(certFile, keyFile string), the only differnece is the parameter type.

What did you expect to see?

ListenAndServeTLS(certBytes, keyBytes []bytes)

What did you see instead?

@antong
Copy link
Contributor

@antong antong commented Jun 29, 2020

net/http Server has a TLSConfig member for which you can specify Certificates or a GetCertificates funtion.

Please also see https://github.com/golang/go/wiki/Questions .

@baolinCloud
Copy link
Author

@baolinCloud baolinCloud commented Jun 29, 2020

TLSConfig works,thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked pull requests

Successfully merging a pull request may close this issue.

None yet
2 participants
You can’t perform that action at this time.