Giter Club home page Giter Club logo

Comments (3)

yosida95 avatar yosida95 commented on May 26, 2024

rsa_public_key.json follows JWK format as defined in RFC7517.

python-jwt currently could read JWKs of RSA or octet and construct JWK objects from their content. So you can convert your PEM to JWK manually, then pass it to python-jwk.

Furthermore python-jwt could also read a PEM-encoded RSA key and convert it to JSON-serializable Python dict as below.

from jwt import jwk_from_pem

with open('YOUR-RSA-KEY.pem', 'rb') as fh:
    jwk = jwk_from_pem(fh.read())

jwk.to_dict()  # => {'kty': 'RSA', ...}

from python-jwt.

yosida95 avatar yosida95 commented on May 26, 2024

Sorry I maybe miss-read. In README example, it looks different keys are used to sign and verify, but these keys are actually same but encoded in difference format.

In real environment, asymmetric keys are used in almost all deployments, and signer and verifier are generally difference actors, signer have a private key and verifier have only a public key corresponding to signer's private key. On this assumption, PEM encoded private key is suitable for signer side in terms of operational ease, on the other hand JWK(JSON) format is convenient to distribute publicly.

So I presented two ways in README to express both ways are supported in python-jwt.

from python-jwt.

 avatar commented on May 26, 2024

I see. My false impression was that you described a way to sign with the private and verify with the public key.

from python-jwt.

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.