Giter Site home page Giter Site logo

Comments (4)

benmcollins avatar benmcollins commented on August 17, 2024

LibJWT expects an RSA PublicKey for verification, not a certificate. This may help:

https://knowledge.digicert.com/solution/SO21807.html

from libjwt.

xiao8385 avatar xiao8385 commented on August 17, 2024

My mistake not describe clear.

We already get the public key, and use public key can decode the token at this site .
It shows "Signature Verified". and "alg": "RS256".

I list down the snapshot for jwt.io not sure if you can see.
image
Capture

The issue is when we use the public key to decode the token, we have to pass a parameter JWT_ALG_NONE then can successfully decode. And check the ALG value is 0. I'm not sure if this is valid cause the ALG should be RS256.

from libjwt.

benmcollins avatar benmcollins commented on August 17, 2024

That is not a "Public Key" that is a Certificate (it says so in the file). Do this:

openssl x509 -pubkey -in yourcert.pem

Which will get you this public key:

-----BEGIN PUBLIC KEY-----
MIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAknPGNQ2+zKdm/rCQQ8GW
264I73974dxZfu0B8rhqXdchPHHKVAxr4b+aphphB6Ht0mNEGAuaW/21hXB9lIOb
pcR9wMvTV6Bfuvf33Slqk6y2/hczblbEZ9q1O2xtfwoKJbGoL5cvQVtmJvvW2Wep
rQQrsSAmfCa/sGCSlGd98U05inVaaPpIfRegyeiA4mbdCPcKRZiRaHMKUACjgobO
lOItgTOGu2xUJtNnKbZpy1qwkCtcTHDKUmX0R5g7RHxyZ6aHxS979570fc0A0d3A
Xlr9hrJO4vo7kchvLk+4yVQN4JdUMXvtHlKhgQw1achU6q8jaatIXLTvSNkZIjTj
KQIDAQAB
-----END PUBLIC KEY-----

Use this with LibJWT to verify the JWT. This works on JWT.io and in LibJWT.

from libjwt.

xiao8385 avatar xiao8385 commented on August 17, 2024

Ooh, you are right.
Thank you very much! :)

from libjwt.

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.