Hello community, here is the log from the commit of package python-python-jose for openSUSE:Factory checked in at 2020-08-06 10:42:19 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/python-python-jose (Old) and /work/SRC/openSUSE:Factory/.python-python-jose.new.3399 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "python-python-jose" Thu Aug 6 10:42:19 2020 rev:4 rq:824582 version:3.2.0 Changes: -------- --- /work/SRC/openSUSE:Factory/python-python-jose/python-python-jose.changes 2020-03-10 11:55:26.687728660 +0100 +++ /work/SRC/openSUSE:Factory/.python-python-jose.new.3399/python-python-jose.changes 2020-08-06 10:42:28.110130506 +0200 @@ -1,0 +2,15 @@ +Wed Aug 5 12:58:25 UTC 2020 - Marketa Calabkova <[email protected]> + +- Update to 3.2.0 + * This will be the last release supporting Python 2.7, 3.5, and the PyCrypto + backend. + * Use hmac.compare_digest instead of our own constant_time_string_compare #163 + * Fix `to_dict` output, which should always be JSON encodeable. #139 and #165 + (fixes #127 and #137) + * Require setuptools >= 39.2.0 #167 (fixes #161) + * Emit a warning when verifying with a private key #168 (fixes #53 and #142) + * Avoid loading python-ecdsa when using the cryptography backend, and pinned + python-ecdsa dependency to <0.15 #178 +- Rebase patch unpin-deps.patch + +------------------------------------------------------------------- Old: ---- python-jose-3.1.0.tar.gz New: ---- python-jose-3.2.0.tar.gz ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ python-python-jose.spec ++++++ --- /var/tmp/diff_new_pack.wE2EpU/_old 2020-08-06 10:42:29.290131097 +0200 +++ /var/tmp/diff_new_pack.wE2EpU/_new 2020-08-06 10:42:29.294131099 +0200 @@ -18,14 +18,14 @@ %{?!python_module:%define python_module() python-%{**} python3-%{**}} Name: python-python-jose -Version: 3.1.0 +Version: 3.2.0 Release: 0 Summary: JOSE implementation in Python License: MIT URL: https://github.com/mpdavis/python-jose Source: https://github.com/mpdavis/python-jose/archive/%{version}.tar.gz#/python-jose-%{version}.tar.gz Patch0: unpin-deps.patch -BuildRequires: %{python_module setuptools} +BuildRequires: %{python_module setuptools >= 39.2.0} BuildRequires: fdupes BuildRequires: python-rpm-macros Requires: python-six ++++++ python-jose-3.1.0.tar.gz -> python-jose-3.2.0.tar.gz ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-jose-3.1.0/.travis.yml new/python-jose-3.2.0/.travis.yml --- old/python-jose-3.1.0/.travis.yml 2019-12-10 10:43:04.000000000 +0100 +++ new/python-jose-3.2.0/.travis.yml 2020-07-30 02:27:33.000000000 +0200 @@ -12,7 +12,7 @@ include: # Linting - python: 3.6 - env: TOX_ENV=flake8 + env: TOXENV=flake8 # CPython 2.7 - python: 2.7 env: TOXENV=py27-base diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-jose-3.1.0/CHANGELOG.md new/python-jose-3.2.0/CHANGELOG.md --- old/python-jose-3.1.0/CHANGELOG.md 2019-12-10 10:43:04.000000000 +0100 +++ new/python-jose-3.2.0/CHANGELOG.md 2020-07-30 02:27:33.000000000 +0200 @@ -1,5 +1,28 @@ # Changelog # +## 3.2.0 -- 2020-07-29 ## + +### News ### + +* This will be the last release supporting Python 2.7, 3.5, and the PyCrypto + backend. + +### Bug fixes and Improvements ### + +* Use hmac.compare_digest instead of our own constant_time_string_compare #163 +* Fix `to_dict` output, which should always be JSON encodeable. #139 and #165 + (fixes #127 and #137) +* Require setuptools >= 39.2.0 #167 (fixes #161) +* Emit a warning when verifying with a private key #168 (fixes #53 and #142) +* Avoid loading python-ecdsa when using the cryptography backend, and pinned + python-ecdsa dependency to <0.15 #178 + +### Housekeeping ### + +* Fixed some typos #160, #162, and #164 + + + ## 3.1.0 -- 2019-12-10 ## This is a greatly overdue release. diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-jose-3.1.0/jose/__init__.py new/python-jose-3.2.0/jose/__init__.py --- old/python-jose-3.1.0/jose/__init__.py 2019-12-10 10:43:04.000000000 +0100 +++ new/python-jose-3.2.0/jose/__init__.py 2020-07-30 02:27:33.000000000 +0200 @@ -1,5 +1,5 @@ -__version__ = "3.1.0" +__version__ = "3.2.0" __author__ = 'Michael Davis' __license__ = 'MIT' __copyright__ = 'Copyright 2016 Michael Davis' diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-jose-3.1.0/jose/backends/cryptography_backend.py new/python-jose-3.2.0/jose/backends/cryptography_backend.py --- old/python-jose-3.1.0/jose/backends/cryptography_backend.py 2019-12-10 10:43:04.000000000 +0100 +++ new/python-jose-3.2.0/jose/backends/cryptography_backend.py 2020-07-30 02:27:33.000000000 +0200 @@ -4,11 +4,6 @@ import six -try: - from ecdsa import SigningKey as EcdsaSigningKey, VerifyingKey as EcdsaVerifyingKey -except ImportError: - EcdsaSigningKey = EcdsaVerifyingKey = None - from jose.backends.base import Key from jose.utils import base64_to_long, long_to_base64 from jose.constants import ALGORITHMS @@ -46,7 +41,7 @@ self.prepared_key = key return - if None not in (EcdsaSigningKey, EcdsaVerifyingKey) and isinstance(key, (EcdsaSigningKey, EcdsaVerifyingKey)): + if hasattr(key, 'to_pem'): # convert to PEM and let cryptography below load it as PEM key = key.to_pem().decode('utf-8') @@ -76,7 +71,7 @@ def _process_jwk(self, jwk_dict): if not jwk_dict.get('kty') == 'EC': - raise JWKError("Incorrect key type. Expected: 'EC', Received: %s" % jwk_dict.get('kty')) + raise JWKError("Incorrect key type. Expected: 'EC', Received: %s" % jwk_dict.get('kty')) if not all(k in jwk_dict for k in ['x', 'y', 'crv']): raise JWKError('Mandatory parameters are missing') @@ -183,15 +178,15 @@ 'alg': self._algorithm, 'kty': 'EC', 'crv': crv, - 'x': long_to_base64(public_key.public_numbers().x, size=key_size), - 'y': long_to_base64(public_key.public_numbers().y, size=key_size), + 'x': long_to_base64(public_key.public_numbers().x, size=key_size).decode('ASCII'), + 'y': long_to_base64(public_key.public_numbers().y, size=key_size).decode('ASCII'), } if not self.is_public(): data['d'] = long_to_base64( self.prepared_key.private_numbers().private_value, size=key_size - ) + ).decode('ASCII') return data @@ -244,7 +239,7 @@ def _process_jwk(self, jwk_dict): if not jwk_dict.get('kty') == 'RSA': - raise JWKError("Incorrect key type. Expected: 'RSA', Received: %s" % jwk_dict.get('kty')) + raise JWKError("Incorrect key type. Expected: 'RSA', Received: %s" % jwk_dict.get('kty')) e = base64_to_long(jwk_dict.get('e', 256)) n = base64_to_long(jwk_dict.get('n')) @@ -354,18 +349,18 @@ data = { 'alg': self._algorithm, 'kty': 'RSA', - 'n': long_to_base64(public_key.public_numbers().n), - 'e': long_to_base64(public_key.public_numbers().e), + 'n': long_to_base64(public_key.public_numbers().n).decode('ASCII'), + 'e': long_to_base64(public_key.public_numbers().e).decode('ASCII'), } if not self.is_public(): data.update({ - 'd': long_to_base64(self.prepared_key.private_numbers().d), - 'p': long_to_base64(self.prepared_key.private_numbers().p), - 'q': long_to_base64(self.prepared_key.private_numbers().q), - 'dp': long_to_base64(self.prepared_key.private_numbers().dmp1), - 'dq': long_to_base64(self.prepared_key.private_numbers().dmq1), - 'qi': long_to_base64(self.prepared_key.private_numbers().iqmp), + 'd': long_to_base64(self.prepared_key.private_numbers().d).decode('ASCII'), + 'p': long_to_base64(self.prepared_key.private_numbers().p).decode('ASCII'), + 'q': long_to_base64(self.prepared_key.private_numbers().q).decode('ASCII'), + 'dp': long_to_base64(self.prepared_key.private_numbers().dmp1).decode('ASCII'), + 'dq': long_to_base64(self.prepared_key.private_numbers().dmq1).decode('ASCII'), + 'qi': long_to_base64(self.prepared_key.private_numbers().iqmp).decode('ASCII'), }) return data diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-jose-3.1.0/jose/backends/ecdsa_backend.py new/python-jose-3.2.0/jose/backends/ecdsa_backend.py --- old/python-jose-3.1.0/jose/backends/ecdsa_backend.py 2019-12-10 10:43:04.000000000 +0100 +++ new/python-jose-3.2.0/jose/backends/ecdsa_backend.py 2020-07-30 02:27:33.000000000 +0200 @@ -70,7 +70,7 @@ def _process_jwk(self, jwk_dict): if not jwk_dict.get('kty') == 'EC': - raise JWKError("Incorrect key type. Expected: 'EC', Recieved: %s" % jwk_dict.get('kty')) + raise JWKError("Incorrect key type. Expected: 'EC', Received: %s" % jwk_dict.get('kty')) if not all(k in jwk_dict for k in ['x', 'y', 'crv']): raise JWKError('Mandatory parameters are missing') @@ -131,14 +131,14 @@ 'alg': self._algorithm, 'kty': 'EC', 'crv': crv, - 'x': long_to_base64(public_key.pubkey.point.x(), size=key_size), - 'y': long_to_base64(public_key.pubkey.point.y(), size=key_size), + 'x': long_to_base64(public_key.pubkey.point.x(), size=key_size).decode('ASCII'), + 'y': long_to_base64(public_key.pubkey.point.y(), size=key_size).decode('ASCII'), } if not self.is_public(): data['d'] = long_to_base64( self.prepared_key.privkey.secret_multiplier, size=key_size - ) + ).decode('ASCII') return data diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-jose-3.1.0/jose/backends/pycrypto_backend.py new/python-jose-3.2.0/jose/backends/pycrypto_backend.py --- old/python-jose-3.1.0/jose/backends/pycrypto_backend.py 2019-12-10 10:43:04.000000000 +0100 +++ new/python-jose-3.2.0/jose/backends/pycrypto_backend.py 2020-07-30 02:27:33.000000000 +0200 @@ -1,6 +1,7 @@ from base64 import b64encode import six +import warnings import Crypto.Hash.SHA256 import Crypto.Hash.SHA384 @@ -95,7 +96,7 @@ def _process_jwk(self, jwk_dict): if not jwk_dict.get('kty') == 'RSA': - raise JWKError("Incorrect key type. Expected: 'RSA', Recieved: %s" % jwk_dict.get('kty')) + raise JWKError("Incorrect key type. Expected: 'RSA', Received: %s" % jwk_dict.get('kty')) e = base64_to_long(jwk_dict.get('e', 256)) n = base64_to_long(jwk_dict.get('n')) @@ -147,6 +148,9 @@ raise JWKError(e) def verify(self, msg, sig): + if not self.is_public(): + warnings.warn("Attempting to verify a message with a private key. " + "This is not recommended.") try: return PKCS1_v1_5.new(self.prepared_key).verify(self.hash_alg.new(msg), sig) except Exception: @@ -185,8 +189,8 @@ data = { 'alg': self._algorithm, 'kty': 'RSA', - 'n': long_to_base64(self.prepared_key.n), - 'e': long_to_base64(self.prepared_key.e), + 'n': long_to_base64(self.prepared_key.n).decode('ASCII'), + 'e': long_to_base64(self.prepared_key.e).decode('ASCII'), } if not self.is_public(): @@ -201,12 +205,12 @@ dp = self.prepared_key.d % (self.prepared_key.p - 1) dq = self.prepared_key.d % (self.prepared_key.q - 1) data.update({ - 'd': long_to_base64(self.prepared_key.d), - 'p': long_to_base64(self.prepared_key.q), - 'q': long_to_base64(self.prepared_key.p), - 'dp': long_to_base64(dq), - 'dq': long_to_base64(dp), - 'qi': long_to_base64(self.prepared_key.u), + 'd': long_to_base64(self.prepared_key.d).decode('ASCII'), + 'p': long_to_base64(self.prepared_key.q).decode('ASCII'), + 'q': long_to_base64(self.prepared_key.p).decode('ASCII'), + 'dp': long_to_base64(dq).decode('ASCII'), + 'dq': long_to_base64(dp).decode('ASCII'), + 'qi': long_to_base64(self.prepared_key.u).decode('ASCII'), }) return data diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-jose-3.1.0/jose/backends/rsa_backend.py new/python-jose-3.2.0/jose/backends/rsa_backend.py --- old/python-jose-3.1.0/jose/backends/rsa_backend.py 2019-12-10 10:43:04.000000000 +0100 +++ new/python-jose-3.2.0/jose/backends/rsa_backend.py 2020-07-30 02:27:33.000000000 +0200 @@ -1,6 +1,8 @@ import binascii import six +import warnings + from pyasn1.error import PyAsn1Error import rsa as pyrsa @@ -170,7 +172,7 @@ def _process_jwk(self, jwk_dict): if not jwk_dict.get('kty') == 'RSA': - raise JWKError("Incorrect key type. Expected: 'RSA', Recieved: %s" % jwk_dict.get('kty')) + raise JWKError("Incorrect key type. Expected: 'RSA', Received: %s" % jwk_dict.get('kty')) e = base64_to_long(jwk_dict.get('e')) n = base64_to_long(jwk_dict.get('n')) @@ -200,6 +202,9 @@ return pyrsa.sign(msg, self._prepared_key, self.hash_alg) def verify(self, msg, sig): + if not self.is_public(): + warnings.warn("Attempting to verify a message with a private key. " + "This is not recommended.") try: pyrsa.verify(msg, sig, self._prepared_key) return True @@ -246,18 +251,18 @@ data = { 'alg': self._algorithm, 'kty': 'RSA', - 'n': long_to_base64(public_key.n), - 'e': long_to_base64(public_key.e), + 'n': long_to_base64(public_key.n).decode('ASCII'), + 'e': long_to_base64(public_key.e).decode('ASCII'), } if not self.is_public(): data.update({ - 'd': long_to_base64(self._prepared_key.d), - 'p': long_to_base64(self._prepared_key.p), - 'q': long_to_base64(self._prepared_key.q), - 'dp': long_to_base64(self._prepared_key.exp1), - 'dq': long_to_base64(self._prepared_key.exp2), - 'qi': long_to_base64(self._prepared_key.coef), + 'd': long_to_base64(self._prepared_key.d).decode('ASCII'), + 'p': long_to_base64(self._prepared_key.p).decode('ASCII'), + 'q': long_to_base64(self._prepared_key.q).decode('ASCII'), + 'dp': long_to_base64(self._prepared_key.exp1).decode('ASCII'), + 'dq': long_to_base64(self._prepared_key.exp2).decode('ASCII'), + 'qi': long_to_base64(self._prepared_key.coef).decode('ASCII'), }) return data diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-jose-3.1.0/jose/exceptions.py new/python-jose-3.2.0/jose/exceptions.py --- old/python-jose-3.1.0/jose/exceptions.py 2019-12-10 10:43:04.000000000 +0100 +++ new/python-jose-3.2.0/jose/exceptions.py 2020-07-30 02:27:33.000000000 +0200 @@ -24,10 +24,6 @@ pass -class JWTSignatureError(JWTError): - pass - - class ExpiredSignatureError(JWTError): pass diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-jose-3.1.0/jose/jwk.py new/python-jose-3.2.0/jose/jwk.py --- old/python-jose-3.1.0/jose/jwk.py 2019-12-10 10:43:04.000000000 +0100 +++ new/python-jose-3.2.0/jose/jwk.py 2020-07-30 02:27:33.000000000 +0200 @@ -6,7 +6,6 @@ from jose.constants import ALGORITHMS from jose.exceptions import JWKError from jose.utils import base64url_decode, base64url_encode -from jose.utils import constant_time_string_compare from jose.backends.base import Key try: @@ -36,7 +35,7 @@ def register_key(algorithm, key_class): if not issubclass(key_class, Key): - raise TypeError("Key class not a subclass of jwk.Key") + raise TypeError("Key class is not a subclass of jwk.Key") ALGORITHMS.KEYS[algorithm] = key_class ALGORITHMS.SUPPORTED.add(algorithm) return True @@ -53,11 +52,11 @@ algorithm = key_data.get('alg', None) if not algorithm: - raise JWKError('Unable to find a algorithm for key: %s' % key_data) + raise JWKError('Unable to find an algorithm for key: %s' % key_data) key_class = get_key(algorithm) if not key_class: - raise JWKError('Unable to find a algorithm for key: %s' % key_data) + raise JWKError('Unable to find an algorithm for key: %s' % key_data) return key_class(key_data, algorithm) @@ -119,7 +118,7 @@ def _process_jwk(self, jwk_dict): if not jwk_dict.get('kty') == 'oct': - raise JWKError("Incorrect key type. Expected: 'oct', Recieved: %s" % jwk_dict.get('kty')) + raise JWKError("Incorrect key type. Expected: 'oct', Received: %s" % jwk_dict.get('kty')) k = jwk_dict.get('k') k = k.encode('utf-8') @@ -132,11 +131,11 @@ return hmac.new(self.prepared_key, msg, self.hash_alg).digest() def verify(self, msg, sig): - return constant_time_string_compare(sig, self.sign(msg)) + return hmac.compare_digest(sig, self.sign(msg)) def to_dict(self): return { 'alg': self._algorithm, 'kty': 'oct', - 'k': base64url_encode(self.prepared_key), + 'k': base64url_encode(self.prepared_key).decode('ASCII'), } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-jose-3.1.0/jose/utils.py new/python-jose-3.2.0/jose/utils.py --- old/python-jose-3.1.0/jose/utils.py 2019-12-10 10:43:04.000000000 +0100 +++ new/python-jose-3.2.0/jose/utils.py 2020-07-30 02:27:33.000000000 +0200 @@ -1,6 +1,5 @@ import base64 -import hmac import six import struct import sys @@ -108,27 +107,3 @@ delta (timedelta): A timedelta to convert to seconds. """ return delta.days * 24 * 60 * 60 + delta.seconds - - -def constant_time_string_compare(a, b): - """Helper for comparing string in constant time, independent - of the python version being used. - - Args: - a (str): A string to compare - b (str): A string to compare - """ - - try: - return hmac.compare_digest(a, b) - except AttributeError: - - if len(a) != len(b): - return False - - result = 0 - - for x, y in zip(a, b): - result |= ord(x) ^ ord(y) - - return result == 0 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-jose-3.1.0/pytest.ini new/python-jose-3.2.0/pytest.ini --- old/python-jose-3.1.0/pytest.ini 1970-01-01 01:00:00.000000000 +0100 +++ new/python-jose-3.2.0/pytest.ini 2020-07-30 02:27:33.000000000 +0200 @@ -0,0 +1,7 @@ +[pytest] +markers = + pycrypto: marks tests as applicable with PyCrypto backend + pycryptodome: marks tests as applicable with PyCryptodome backend + ecdsa: marks tests as applicable with ecdsa backend + cryptography: marks tests as applicable with cryptography backend + backend_compatibility: mark tests as testing compatibility between backends diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-jose-3.1.0/requirements-dev.txt new/python-jose-3.2.0/requirements-dev.txt --- old/python-jose-3.1.0/requirements-dev.txt 2019-12-10 10:43:04.000000000 +0100 +++ new/python-jose-3.2.0/requirements-dev.txt 2020-07-30 02:27:33.000000000 +0200 @@ -1,4 +1,4 @@ -PyYAML==3.11 +PyYAML==5.1 cov-core==1.15.0 coverage==4.4 coveralls==1.5.1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-jose-3.1.0/requirements.txt new/python-jose-3.2.0/requirements.txt --- old/python-jose-3.1.0/requirements.txt 2019-12-10 10:43:04.000000000 +0100 +++ new/python-jose-3.2.0/requirements.txt 2020-07-30 02:27:33.000000000 +0200 @@ -1,5 +1,5 @@ pycryptodome six rsa -ecdsa +ecdsa<0.15 pyasn1 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-jose-3.1.0/setup.cfg new/python-jose-3.2.0/setup.cfg --- old/python-jose-3.1.0/setup.cfg 2019-12-10 10:43:04.000000000 +0100 +++ new/python-jose-3.2.0/setup.cfg 2020-07-30 02:27:33.000000000 +0200 @@ -1,3 +1,6 @@ +[metadata] +version = attr: jose.__version__ + [flake8] max-line-length = 119 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-jose-3.1.0/setup.py new/python-jose-3.2.0/setup.py --- old/python-jose-3.1.0/setup.py 2019-12-10 10:43:04.000000000 +0100 +++ new/python-jose-3.2.0/setup.py 2020-07-30 02:27:33.000000000 +0200 @@ -3,7 +3,7 @@ import os import platform -import jose +import jose # noqa: F401 from setuptools import setup @@ -38,7 +38,7 @@ 'pycrypto': ['pycrypto >=2.6.0, <2.7.0'] + pyasn1, 'pycryptodome': ['pycryptodome >=3.3.1, <4.0.0'] + pyasn1, } -legacy_backend_requires = ['ecdsa <1.0', 'rsa'] + pyasn1 +legacy_backend_requires = ['ecdsa <0.15', 'rsa'] + pyasn1 install_requires = ['six <2.0'] # TODO: work this into the extras selection instead. @@ -47,7 +47,6 @@ setup( name='python-jose', - version=jose.__version__, author='Michael Davis', author_email='[email protected]', description='JOSE implementation in Python', @@ -71,7 +70,10 @@ 'Topic :: Utilities', ], extras_require=extras_require, - setup_requires=['pytest-runner'], + setup_requires=[ + 'pytest-runner', + 'setuptools>=39.2.0', + ], tests_require=[ 'six', 'ecdsa', diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-jose-3.1.0/tests/algorithms/test_EC.py new/python-jose-3.2.0/tests/algorithms/test_EC.py --- old/python-jose-3.1.0/tests/algorithms/test_EC.py 2019-12-10 10:43:04.000000000 +0100 +++ new/python-jose-3.2.0/tests/algorithms/test_EC.py 2020-07-30 02:27:33.000000000 +0200 @@ -1,3 +1,4 @@ +import json from jose.constants import ALGORITHMS from jose.exceptions import JOSEError, JWKError @@ -194,6 +195,9 @@ # Private parameters should be absent assert 'd' not in as_dict + # as_dict should be serializable to JSON + json.dumps(as_dict) + def test_to_dict(self): key = ECKey(private_key, ALGORITHMS.ES256) self.assert_parameters(key.to_dict(), private=True) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-jose-3.1.0/tests/algorithms/test_HMAC.py new/python-jose-3.2.0/tests/algorithms/test_HMAC.py --- old/python-jose-3.1.0/tests/algorithms/test_HMAC.py 2019-12-10 10:43:04.000000000 +0100 +++ new/python-jose-3.2.0/tests/algorithms/test_HMAC.py 2020-07-30 02:27:33.000000000 +0200 @@ -1,3 +1,4 @@ +import json from jose.constants import ALGORITHMS from jose.exceptions import JOSEError @@ -31,7 +32,7 @@ def test_to_dict(self): passphrase = 'The quick brown fox jumps over the lazy dog' - encoded = b'VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw' + encoded = 'VGhlIHF1aWNrIGJyb3duIGZveCBqdW1wcyBvdmVyIHRoZSBsYXp5IGRvZw' key = HMACKey(passphrase, ALGORITHMS.HS256) as_dict = key.to_dict() @@ -43,3 +44,6 @@ assert 'k' in as_dict assert as_dict['k'] == encoded + + # as_dict should be serializable to JSON + json.dumps(as_dict) diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-jose-3.1.0/tests/algorithms/test_RSA.py new/python-jose-3.2.0/tests/algorithms/test_RSA.py --- old/python-jose-3.1.0/tests/algorithms/test_RSA.py 2019-12-10 10:43:04.000000000 +0100 +++ new/python-jose-3.2.0/tests/algorithms/test_RSA.py 2020-07-30 02:27:33.000000000 +0200 @@ -1,4 +1,5 @@ import base64 +import json import sys try: @@ -370,6 +371,9 @@ assert 'dq' not in as_dict assert 'qi' not in as_dict + # as_dict should be serializable to JSON + json.dumps(as_dict) + def assert_roundtrip(self, key): assert RSAKey( key.to_dict(), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-jose-3.1.0/tests/test_jws.py new/python-jose-3.2.0/tests/test_jws.py --- old/python-jose-3.1.0/tests/test_jws.py 2019-12-10 10:43:04.000000000 +0100 +++ new/python-jose-3.2.0/tests/test_jws.py 2020-07-30 02:27:33.000000000 +0200 @@ -1,11 +1,18 @@ import json +import warnings + +import pytest from jose import jwk from jose import jws +from jose.backends import RSAKey from jose.constants import ALGORITHMS from jose.exceptions import JWSError -import pytest +try: + from jose.backends.cryptography_backend import CryptographyRSAKey +except ImportError: + CryptographyRSAKey = None @pytest.fixture @@ -291,6 +298,20 @@ with pytest.raises(JWSError): jws.verify(token, rsa_public_key, ALGORITHMS.HS256) + @pytest.mark.skipif(RSAKey is CryptographyRSAKey, reason="Cryptography backend outright fails verification") + def test_private_verify_raises_warning(self, payload): + token = jws.sign(payload, rsa_private_key, algorithm='RS256') + + # verify with public + jws.verify(token, rsa_public_key, algorithms='RS256') + + with warnings.catch_warnings(record=True) as w: + # verify with private raises warning + jws.verify(token, rsa_private_key, algorithms='RS256') + + assert ("Attempting to verify a message with a private key. " + "This is not recommended.") == str(w[-1].message) + ec_private_key = """-----BEGIN EC PRIVATE KEY----- MIHcAgEBBEIBzs13YUnYbLfYXTz4SG4DE4rPmsL3wBTdy34JcO+BDpI+NDZ0pqam diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/python-jose-3.1.0/tox.ini new/python-jose-3.2.0/tox.ini --- old/python-jose-3.1.0/tox.ini 2019-12-10 10:43:04.000000000 +0100 +++ new/python-jose-3.2.0/tox.ini 2020-07-30 02:27:33.000000000 +0200 @@ -21,6 +21,8 @@ pytest pytest-cov pytest-runner + -r{toxinidir}/requirements.txt + commands_pre = # Remove the python-rsa and python-ecdsa backends only: pip uninstall -y ecdsa rsa ++++++ unpin-deps.patch ++++++ --- /var/tmp/diff_new_pack.wE2EpU/_old 2020-08-06 10:42:29.382131143 +0200 +++ /var/tmp/diff_new_pack.wE2EpU/_new 2020-08-06 10:42:29.382131143 +0200 @@ -1,7 +1,7 @@ -Index: python-jose-3.1.0/setup.py +Index: python-jose-3.2.0/setup.py =================================================================== ---- python-jose-3.1.0.orig/setup.py -+++ python-jose-3.1.0/setup.py +--- python-jose-3.2.0.orig/setup.py ++++ python-jose-3.2.0/setup.py @@ -35,11 +35,11 @@ def _cryptography_version(): pyasn1 = ['pyasn1'] extras_require = { @@ -11,7 +11,7 @@ + 'pycrypto': ['pycrypto >=2.6.0'] + pyasn1, + 'pycryptodome': ['pycryptodome >=3.3.1'] + pyasn1, } --legacy_backend_requires = ['ecdsa <1.0', 'rsa'] + pyasn1 +-legacy_backend_requires = ['ecdsa <0.15', 'rsa'] + pyasn1 -install_requires = ['six <2.0'] +legacy_backend_requires = ['ecdsa', 'rsa'] + pyasn1 +install_requires = ['six']
