Skip to content

Commit 8d97d58

Browse files
committed
Merge branch 'develop' into x509_symmetry
2 parents f5159ff + a243611 commit 8d97d58

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+206
-317
lines changed

.isort.cfg

Lines changed: 0 additions & 5 deletions
This file was deleted.

.travis.yml

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,10 @@ addons:
1212
-
1313
install:
1414
- pip install codecov
15-
- pip install tox
16-
- pip install tox-travis
17-
- pip install "isort>=5.0.2"
18-
- pip install black
15+
- pip install tox tox-travis
16+
- pip install isort black
1917
script:
20-
- isort --check --recursive src tests
18+
- isort --check src tests
2119
- black --check src tests
2220
- codecov --version
2321
- tox

setup.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
version = re.search(r'^__version__\s*=\s*[\'"]([^\'"]*)[\'"]',
2727
fd.read(), re.MULTILINE).group(1)
2828

29-
tests_requires = ['responses', 'pytest', 'isort', 'black']
29+
tests_requires = ['responses', 'pytest', 'isort>=5.0.2', 'black']
3030

3131
setup(
3232
name="cryptojwt",
@@ -53,7 +53,7 @@
5353
extras_require={
5454
'testing': tests_requires,
5555
'docs': ['Sphinx', 'sphinx-autobuild', 'alabaster'],
56-
'quality': ['isort'],
56+
'quality': ['isort>=5.0.2', 'black'],
5757
},
5858
scripts=glob.glob('script/*.py'),
5959
entry_points={

src/cryptojwt/__init__.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,15 +9,10 @@
99
from cryptojwt.key_jar import KeyJar
1010

1111
from .exception import BadSyntax
12-
from .utils import as_unicode
13-
from .utils import b64d
14-
from .utils import b64encode_item
15-
from .utils import split_token
12+
from .utils import as_unicode, b64d, b64encode_item, split_token
1613

1714
try:
18-
from builtins import zip
19-
from builtins import hex
20-
from builtins import str
15+
from builtins import hex, str, zip
2116
except ImportError:
2217
pass
2318

src/cryptojwt/jwe/aes.py

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,11 @@
33

44
from cryptography.hazmat.backends import default_backend
55
from cryptography.hazmat.primitives import hmac
6-
from cryptography.hazmat.primitives.ciphers import Cipher
7-
from cryptography.hazmat.primitives.ciphers import algorithms
8-
from cryptography.hazmat.primitives.ciphers import modes
6+
from cryptography.hazmat.primitives.ciphers import Cipher, algorithms, modes
97
from cryptography.hazmat.primitives.ciphers.aead import AESGCM
108
from cryptography.hazmat.primitives.padding import PKCS7
119

12-
from ..exception import MissingKey
13-
from ..exception import Unsupported
14-
from ..exception import VerificationError
10+
from ..exception import MissingKey, Unsupported, VerificationError
1511
from . import Encrypter
1612
from .exception import UnsupportedBitLength
1713
from .utils import get_keys_seclen_dgst

src/cryptojwt/jwe/jwe.py

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,14 @@
66
from ..jwk.jwk import key_from_jwk_dict
77
from ..jwk.rsa import RSAKey
88
from ..jwx import JWx
9-
from .exception import DecryptionFailed
10-
from .exception import NoSuitableDecryptionKey
11-
from .exception import NoSuitableECDHKey
12-
from .exception import NoSuitableEncryptionKey
13-
from .exception import NotSupportedAlgorithm
14-
from .exception import WrongEncryptionAlgorithm
9+
from .exception import (
10+
DecryptionFailed,
11+
NoSuitableDecryptionKey,
12+
NoSuitableECDHKey,
13+
NoSuitableEncryptionKey,
14+
NotSupportedAlgorithm,
15+
WrongEncryptionAlgorithm,
16+
)
1517
from .jwe_ec import JWE_EC
1618
from .jwe_hmac import JWE_SYM
1719
from .jwe_rsa import JWE_RSA

src/cryptojwt/jwe/jwe_ec.py

Lines changed: 5 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,14 @@
22

33
from cryptography.hazmat.backends import default_backend
44
from cryptography.hazmat.primitives.asymmetric import ec
5-
from cryptography.hazmat.primitives.keywrap import aes_key_unwrap
6-
from cryptography.hazmat.primitives.keywrap import aes_key_wrap
7-
8-
from ..jwk.ec import NIST2SEC
9-
from ..jwk.ec import ECKey
10-
from ..utils import as_bytes
11-
from ..utils import as_unicode
12-
from ..utils import b64d
13-
from ..utils import b64e
5+
from cryptography.hazmat.primitives.keywrap import aes_key_unwrap, aes_key_wrap
6+
7+
from ..jwk.ec import NIST2SEC, ECKey
8+
from ..utils import as_bytes, as_unicode, b64d, b64e
149
from . import KEY_LEN
1510
from .jwekey import JWEKey
1611
from .jwenc import JWEnc
17-
from .utils import concat_sha256
18-
from .utils import get_random_bytes
12+
from .utils import concat_sha256, get_random_bytes
1913

2014

2115
def ecdh_derive_key(key, epk, apu, apv, alg, dk_len):

src/cryptojwt/jwe/jwe_hmac.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,14 +2,11 @@
22
import zlib
33

44
from cryptography.hazmat.backends import default_backend
5-
from cryptography.hazmat.primitives.keywrap import aes_key_unwrap
6-
from cryptography.hazmat.primitives.keywrap import aes_key_wrap
5+
from cryptography.hazmat.primitives.keywrap import aes_key_unwrap, aes_key_wrap
76

8-
from ..exception import MissingKey
9-
from ..exception import WrongNumberOfParts
7+
from ..exception import MissingKey, WrongNumberOfParts
108
from ..jwk.hmac import SYMKey
11-
from ..utils import as_bytes
12-
from ..utils import intarr2str
9+
from ..utils import as_bytes, intarr2str
1310
from .jwekey import JWEKey
1411
from .jwenc import JWEnc
1512

src/cryptojwt/jwe/jwe_rsa.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,7 @@
33

44
from ..utils import as_bytes
55
from . import SUPPORTED
6-
from .exception import NotSupportedAlgorithm
7-
from .exception import ParameterError
6+
from .exception import NotSupportedAlgorithm, ParameterError
87
from .jwekey import JWEKey
98
from .jwenc import JWEnc
109
from .rsa import RSAEncrypter

src/cryptojwt/jwe/jwekey.py

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,8 @@
11
from ..jwx import JWx
22
from . import KEY_LEN_BYTES
3-
from .aes import AES_CBCEncrypter
4-
from .aes import AES_GCMEncrypter
5-
from .exception import DecryptionFailed
6-
from .exception import NotSupportedAlgorithm
7-
from .utils import alg2keytype
8-
from .utils import get_random_bytes
9-
from .utils import split_ctx_and_tag
3+
from .aes import AES_CBCEncrypter, AES_GCMEncrypter
4+
from .exception import DecryptionFailed, NotSupportedAlgorithm
5+
from .utils import alg2keytype, get_random_bytes, split_ctx_and_tag
106

117

128
class JWEKey(JWx):

0 commit comments

Comments
 (0)