Git Product home page Git Product logo

Comments (4)

lestrrat avatar lestrrat commented on June 1, 2024 1

It would be very helpful if you could provide a minimal reproduction code and/or failing test code, thanks :)

from jwx.

lestrrat avatar lestrrat commented on June 1, 2024 1

Sorry for the wait, and thank you for your help. I incorporated your fix and tests

from jwx.

reinkrul avatar reinkrul commented on June 1, 2024

This is the test case I wrote: x5c_test.go.txt

I'd fix it as follows (jwk/headers_gen.go:274):

	if v, ok := h.Get(X509CertChainKey); ok {
		var chain []*x509.Certificate
		if chain, ok = v.([]*x509.Certificate); !ok {
			return fmt.Errorf("%s is of invalid type %T", X509CertChainKey, v)
		}
		encodedChain, err := marshalX509CertChain(chain)
		if err != nil {
			return err
		}
		m[X509CertChainKey] = encodedChain
	}
func marshalX509CertChain(chain []*x509.Certificate) ([]string, error) {
	encodedCerts := make([]string, len(chain))
	for idx, cert := range chain {
		encodedCerts[idx] = base64.StdEncoding.EncodeToString(cert.Raw)
	}
	return encodedCerts, nil
}

This worked, but then I realized the file is generated and thus would be overwritten. I have no problem creating a pull request, but I don't see where to inject custom marshalling logic for the x5c field.

from jwx.

reinkrul avatar reinkrul commented on June 1, 2024

Awesome, thanks!

from jwx.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.