Commit e21a20ab authored by Simo Sorce's avatar Simo Sorce Committed by Simo Sorce

Make newer linters happy

parent 3db0271a
......@@ -16,12 +16,12 @@ def base64url_encode(payload):
def base64url_decode(payload):
l = len(payload) % 4
if l == 2:
size = len(payload) % 4
if size == 2:
payload += '=='
elif l == 3:
elif size == 3:
payload += '='
elif l != 0:
elif size != 0:
raise ValueError('Invalid base64 string')
return urlsafe_b64decode(payload.encode('utf-8'))
......
......@@ -142,8 +142,8 @@ class _RawEC(_RawJWS):
skey = key.get_op_key('sign', self._curve)
signature = skey.sign(payload, ec.ECDSA(self.hashfn))
r, s = ec_utils.decode_rfc6979_signature(signature)
l = key.get_curve(self._curve).key_size
return _encode_int(r, l) + _encode_int(s, l)
size = key.get_curve(self._curve).key_size
return _encode_int(r, size) + _encode_int(s, size)
def verify(self, key, payload, signature):
pkey = key.get_op_key('verify', self._curve)
......
# Copyright (C) 2015 JWCrypto Project Contributors - see LICENSE file
import os
from binascii import hexlify, unhexlify
from cryptography import x509
......@@ -770,7 +769,7 @@ class JWKSet(dict):
"""
try:
jwkset = json_decode(keyset)
except:
except Exception: # pylint: disable=broad-except
raise InvalidJWKValue()
if 'keys' not in jwkset:
......
......@@ -3,7 +3,6 @@
from __future__ import unicode_literals
import copy
import unittest
from cryptography.hazmat.backends import default_backend
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment