Skip to content

Commit 94ea39a

Browse files
committed
isort & black
1 parent 585cc31 commit 94ea39a

File tree

18 files changed

+38
-122
lines changed

18 files changed

+38
-122
lines changed

src/cryptojwt/jwe/__init__.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,14 +22,7 @@
2222
"ECDH-ES+A192KW",
2323
"ECDH-ES+A256KW",
2424
],
25-
"enc": [
26-
"A128CBC-HS256",
27-
"A192CBC-HS384",
28-
"A256CBC-HS512",
29-
"A128GCM",
30-
"A192GCM",
31-
"A256GCM",
32-
],
25+
"enc": ["A128CBC-HS256", "A192CBC-HS384", "A256CBC-HS512", "A128GCM", "A192GCM", "A256GCM",],
3326
}
3427

3528
DEPRECATED = {

src/cryptojwt/jwe/jwe_ec.py

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -157,12 +157,7 @@ def dec_setup(self, token, key=None, **kwargs):
157157
raise Exception("Unknown key length for algorithm")
158158

159159
self.cek = ecdh_derive_key(
160-
key,
161-
epubkey.pub_key,
162-
apu,
163-
apv,
164-
str(self.headers["enc"]).encode(),
165-
dk_len,
160+
key, epubkey.pub_key, apu, apv, str(self.headers["enc"]).encode(), dk_len,
166161
)
167162
elif self.headers["alg"] in [
168163
"ECDH-ES+A128KW",

src/cryptojwt/jwe/rsa.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@ def encrypt(self, msg, key, sign_padding="pkcs1_padding"):
2020
return key.encrypt(
2121
msg,
2222
_padding(
23-
mgf=padding.MGF1(algorithm=_chosen_hash()),
24-
algorithm=_chosen_hash(),
25-
label=None,
23+
mgf=padding.MGF1(algorithm=_chosen_hash()), algorithm=_chosen_hash(), label=None,
2624
),
2725
)
2826

src/cryptojwt/jwk/ec.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
from cryptography.hazmat.backends import default_backend
22
from cryptography.hazmat.primitives.asymmetric import ec
3+
34
from cryptojwt.exception import KeyNotFound
45

56
from ..exception import DeSerializationNotPossible

src/cryptojwt/jwk/jwk.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -93,9 +93,7 @@ def key_from_jwk_dict(jwk_dict, private=None):
9393
else:
9494
# Ecdsa public key.
9595
ec_pub_numbers = ec.EllipticCurvePublicNumbers(
96-
base64url_to_long(_jwk_dict["x"]),
97-
base64url_to_long(_jwk_dict["y"]),
98-
curve,
96+
base64url_to_long(_jwk_dict["x"]), base64url_to_long(_jwk_dict["y"]), curve,
9997
)
10098
_jwk_dict["pub_key"] = ec_pub_numbers.public_key(backends.default_backend())
10199
return ECKey(**_jwk_dict)

src/cryptojwt/jwk/rsa.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
from cryptography.hazmat.backends import default_backend
55
from cryptography.hazmat.primitives import serialization
66
from cryptography.hazmat.primitives.asymmetric import rsa
7+
78
from cryptojwt.exception import KeyNotFound
89

910
from ..exception import DeSerializationNotPossible

src/cryptojwt/jws/jws.py

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -321,11 +321,7 @@ def verify_json(self, jws, keys=None, allow_none=False, at_least_one=False):
321321
for _sign in _signs:
322322
protected_headers = _sign.get("protected", "")
323323
token = b".".join(
324-
[
325-
protected_headers.encode(),
326-
_payload.encode(),
327-
_sign["signature"].encode(),
328-
]
324+
[protected_headers.encode(), _payload.encode(), _sign["signature"].encode(),]
329325
)
330326

331327
unprotected_headers = _sign.get("header", {})

src/cryptojwt/jws/pss.py

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -38,8 +38,7 @@ def sign(self, msg, key):
3838
sig = key.sign(
3939
digest,
4040
padding.PSS(
41-
mgf=padding.MGF1(self.hash_algorithm()),
42-
salt_length=padding.PSS.MAX_LENGTH,
41+
mgf=padding.MGF1(self.hash_algorithm()), salt_length=padding.PSS.MAX_LENGTH,
4342
),
4443
utils.Prehashed(self.hash_algorithm()),
4544
)
@@ -60,8 +59,7 @@ def verify(self, msg, signature, key):
6059
signature,
6160
msg,
6261
padding.PSS(
63-
mgf=padding.MGF1(self.hash_algorithm()),
64-
salt_length=padding.PSS.MAX_LENGTH,
62+
mgf=padding.MGF1(self.hash_algorithm()), salt_length=padding.PSS.MAX_LENGTH,
6563
),
6664
self.hash_algorithm(),
6765
)

src/cryptojwt/key_bundle.py

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -484,9 +484,7 @@ def do_remote(self):
484484
self.time_out = time.time() + self.cache_time
485485
else:
486486
LOGGER.warning(
487-
"HTTP status %d reading remote JWKS from %s",
488-
_http_resp.status_code,
489-
self.source,
487+
"HTTP status %d reading remote JWKS from %s", _http_resp.status_code, self.source,
490488
)
491489
self.ignore_errors_until = time.time() + self.ignore_errors_period
492490
raise UpdateFailed(REMOTE_FAILED.format(self.source, _http_resp.status_code))

src/cryptojwt/key_jar.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -690,10 +690,7 @@ def dumps(self, exclude_issuers: Optional[List[str]] = None):
690690
return json.dumps(_dict)
691691

692692
def load(
693-
self,
694-
info: dict,
695-
init_args: Optional[dict] = None,
696-
load_args: Optional[dict] = None,
693+
self, info: dict, init_args: Optional[dict] = None, load_args: Optional[dict] = None,
697694
):
698695
"""
699696
@@ -814,11 +811,7 @@ def build_keyjar(key_conf, kid_template="", keyjar=None, issuer_id=""):
814811

815812
@deprecated_alias(issuer="issuer_id", owner="issuer_id")
816813
def init_key_jar(
817-
public_path="",
818-
private_path="",
819-
key_defs="",
820-
issuer_id="",
821-
read_only=True,
814+
public_path="", private_path="", key_defs="", issuer_id="", read_only=True,
822815
):
823816
"""
824817
A number of cases here:
@@ -860,10 +853,7 @@ def init_key_jar(
860853
"""
861854

862855
_issuer = init_key_issuer(
863-
public_path=public_path,
864-
private_path=private_path,
865-
key_defs=key_defs,
866-
read_only=read_only,
856+
public_path=public_path, private_path=private_path, key_defs=key_defs, read_only=read_only,
867857
)
868858

869859
if _issuer is None:

0 commit comments

Comments
 (0)