-
Notifications
You must be signed in to change notification settings - Fork 17.8k
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
crypto/x509: enable deep copy of x509.CertPool #24540
Comments
The use case is to call We could look at this as a proposal to add |
@FiloSottile yes, your use case assumption is correct. Concerning a use case, you wouldn't be reloading the cert pool, just establishing a common base for which to build different, dynamic RootCA bundles from. If it is decided that this is okay to be implemented, i'd be willing to provide the implementation. I think your suggestion to cache the pool is a promising one as it doesn't change the existing API. Of course, as you alluded to, it would technically be a change in behavior and so anyone that was expecting numerous calls to |
Interestingly there is some caching already. https://github.com/golang/go/blob/go1.10/src/crypto/x509/root.go#L20-L21 Lines 827 to 828 in 4b1d704
|
Good catch. Looks like I think it would be even more consistent to document that loading happens only once and Let's do that. |
Change https://golang.org/cl/102699 mentions this issue: |
What version of Go are you using (
go version
)?go version go1.10 darwin/amd64
Does this issue reproduce with the latest release?
yes
What operating system and processor architecture are you using (
go env
)?Feature Request
Currently, because
x509.CertPool
contains no exported fields, it is impossible to create a deep copy. For performance reasons, it might be desired to computex509.SystemCertPool()
only once and extract of copy of it for each request if dynamic TLS needs to be configured.As a workaround, I could currently do one of the following:
crypto/x509
package that load the cert poolIdeally, I would like to be able to make a deep copy of
*x509.CertPool
.The text was updated successfully, but these errors were encountered: