GithubHelp home page GithubHelp logo

Invalid signature about jsonwebtoken HOT 1 OPEN

KevinNaidoo avatar KevinNaidoo commented on June 1, 2024
Invalid signature

from jsonwebtoken.

Comments (1)

waynr avatar waynr commented on June 1, 2024 1

I've run into a similar issue and have identified the problem as being incompatible signature format.

In the product I am working on I am attempting to validate JWTs whose signatures were produced by google cloud's KMS. In KMS signature verification example doc we can see the doc writers assume a KMS-generated signature would be in ASN1 format:

        // Verify Elliptic Curve signature.
        var parsedSig struct{ R, S *big.Int }
        if _, err = asn1.Unmarshal(signature, &parsedSig); err != nil {
                return fmt.Errorf("asn1.Unmarshal: %w", err)
        }

But jsonwebtoken seems to assume a PKCS#11 style "fixed" signature serialization format

With no way to prefer (when signing) or detect (when verifying) the use of ASN1 for signature serialization.

I'd be willing to submit a PR to address this issue if the maintainer could provide guidance on the preferred approach for enabling the detection or selection of signature serialization format at the public crate api level. I imagine it could be as simple as providing encode_asn1 and decode_asn1 funtions.

from jsonwebtoken.

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.