joserfc is a Python library that provides a comprehensive implementation of several essential JSON Object Signing and Encryption (JOSE) standards, including JWS (JSON Web Signature), JWE (JSON Web Encryption), JWK (JSON Web Key), JWA (JSON Web Algorithms), and JWT (JSON Web Tokens).

It is derived from Authlib, but features a redesigned API specific to JOSE functionality.


A quick and simple JWT encoding and decoding would look something like this:

>>> from joserfc import jwt
>>> from joserfc.jwk import OctKey
>>> key = OctKey.import_key("secret")
>>> encoded = jwt.encode({"alg": "HS256"}, {"k": "value"}, key)
>>> encoded
>>> token = jwt.decode(encoded, key)
>>> token.header
{'alg': 'HS256', 'typ': 'JWT'}
{'k': 'value'}

You would find more details and advanced usage in JSON Web Token section.


The string "secret" employed in the above example is solely intended for demonstration purposes. In a production environment, it is crucial to use a highly secure secret key to ensure robust security measures.


It follows RFCs with extensible API. The module has implementations of:

And draft RFCs implementation of:


RFC7520 is implemented as test cases.


Explore the following sections to discover more about joserfc and its features.