Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
# Changelog #

## 4.0.0 ##

* Remove dependencies on ecdsa, pyasn1, rsa.
cryptography is now a required dependency.
Remove non-cryptography backends.

## 3.5.0 -- 2025-05-28 ##

### News ###
Expand Down
42 changes: 5 additions & 37 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -21,50 +21,20 @@ Installation

::

$ pip install python-jose[cryptography]
$ pip install python-jose


Cryptographic Backends
----------------------

As of 3.3.0, python-jose implements three different cryptographic backends.
The backend must be selected as an extra when installing python-jose.
If you do not select a backend, the native-python backend will be installed.

Unless otherwise noted, all backends support all operations.

Due to complexities with setuptools, the native-python backend is always installed,
even if you select a different backend on install.
We recommend that you remove unnecessary dependencies in production.
python-jose used to have various cryptographic backends, but due to deprecation
of ecdsa & rsa libraries, the only supported backend as of 4.0.0 is based on
the cryptography lib.

#. cryptography

* This backend uses `pyca/cryptography`_ for all cryptographic operations.
This is the recommended backend and is selected over all other backends if any others are present.
* Installation: ``pip install python-jose[cryptography]``
* Unused dependencies:

* ``rsa``
* ``ecdsa``
* ``pyasn1``

#. pycryptodome

* This backend uses `pycryptodome`_ for all cryptographic operations.
* Installation: ``pip install python-jose[pycryptodome]``
* Unused dependencies:

* ``rsa``

#. native-python

* This backend uses `python-rsa`_ and `python-ecdsa`_ for all cryptographic operations.
This backend is always installed but any other backend will take precedence if one is installed.
* Installation: ``pip install python-jose``

.. note::

The native-python backend cannot process certificates.
This is the **required** backend and is selected over all other backends.

Usage
-----
Expand Down Expand Up @@ -99,8 +69,6 @@ This library was originally based heavily on the work of the folks over at PyJWT
.. _pyca/cryptography: http://cryptography.io/
.. _pycryptodome: https://pycryptodome.readthedocs.io/en/latest/
.. _pycrypto: https://www.dlitz.net/software/pycrypto/
.. _python-ecdsa: https://github.com/warner/python-ecdsa
.. _python-rsa: https://stuvel.eu/rsa
.. |style| image:: https://img.shields.io/badge/code%20style-black-000000.svg
:target: https://github.com/psf/black
:alt: Code style: black
1 change: 0 additions & 1 deletion TODO.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# TODO

* Gracefully fail if ECDSA is used with ecdsa installed
* Refactor JWS json decode and load
* Implement RSA PSS signing
* Implement JWE
Expand Down
2 changes: 1 addition & 1 deletion jose/__init__.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
__version__ = "3.5.0"
__version__ = "4.0.0"
__author__ = "Michael Davis"
__license__ = "MIT"
__copyright__ = "Copyright 2016 Michael Davis"
Expand Down
27 changes: 4 additions & 23 deletions jose/backends/__init__.py
Original file line number Diff line number Diff line change
@@ -1,26 +1,7 @@
from jose.backends.cryptography_backend import CryptographyAESKey as AESKey # noqa: F401
from jose.backends.cryptography_backend import CryptographyECKey as ECKey # noqa: F401
from jose.backends.cryptography_backend import CryptographyHMACKey as HMACKey # noqa: F401
from jose.backends.cryptography_backend import CryptographyRSAKey as RSAKey # noqa: F401
from jose.backends.native import get_random_bytes # noqa: F401

try:
from jose.backends.cryptography_backend import CryptographyRSAKey as RSAKey # noqa: F401
except ImportError:
try:
from jose.backends.rsa_backend import RSAKey # noqa: F401
except ImportError:
RSAKey = None

try:
from jose.backends.cryptography_backend import CryptographyECKey as ECKey # noqa: F401
except ImportError:
from jose.backends.ecdsa_backend import ECDSAECKey as ECKey # noqa: F401

try:
from jose.backends.cryptography_backend import CryptographyAESKey as AESKey # noqa: F401
except ImportError:
AESKey = None

try:
from jose.backends.cryptography_backend import CryptographyHMACKey as HMACKey # noqa: F401
except ImportError:
from jose.backends.native import HMACKey # noqa: F401

from .base import DIRKey # noqa: F401
84 changes: 0 additions & 84 deletions jose/backends/_asn1.py

This file was deleted.

150 changes: 0 additions & 150 deletions jose/backends/ecdsa_backend.py

This file was deleted.

Loading