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

Set (*tls.Certificate).Leaf from the tlsconfig.GetCertificate callback #299

Open
jpeach opened this issue Sep 23, 2024 · 0 comments
Open

Comments

@jpeach
Copy link

jpeach commented Sep 23, 2024

The Leaf field can be set to a pre-parsed *x509.Certificate, which I believe we should already have from the SVID.

So something like this should remove the need for an additional certificate parse:

diff --git v2/spiffetls/tlsconfig/config.go v2/spiffetls/tlsconfig/config.go
index 0ef3969..a5706ea 100644
--- v2/spiffetls/tlsconfig/config.go
+++ v2/spiffetls/tlsconfig/config.go
@@ -221,6 +221,7 @@ func getTLSCertificate(svid x509svid.Source, trace Trace) (*tls.Certificate, err
        cert := &tls.Certificate{
                Certificate: make([][]byte, 0, len(s.Certificates)),
                PrivateKey:  s.PrivateKey,
+               Leaf:        s.Certificates[0],
        }

        for _, svidCert := range s.Certificates {
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant