diff options
Diffstat (limited to 'jwt/contrib/algorithms')
-rw-r--r-- | jwt/contrib/algorithms/py_ecdsa.py | 3 | ||||
-rw-r--r-- | jwt/contrib/algorithms/pycrypto.py | 3 |
2 files changed, 4 insertions, 2 deletions
diff --git a/jwt/contrib/algorithms/py_ecdsa.py b/jwt/contrib/algorithms/py_ecdsa.py index bf0dea5..23016fc 100644 --- a/jwt/contrib/algorithms/py_ecdsa.py +++ b/jwt/contrib/algorithms/py_ecdsa.py @@ -7,6 +7,7 @@ import ecdsa from jwt.algorithms import Algorithm from jwt.compat import string_types, text_type +from jwt.exceptions import InvalidAsymmetricKeyError class ECAlgorithm(Algorithm): @@ -44,7 +45,7 @@ class ECAlgorithm(Algorithm): key = ecdsa.SigningKey.from_pem(key) else: - raise TypeError('Expecting a PEM-formatted key.') + raise InvalidAsymmetricKeyError('Expecting a PEM-formatted key.') return key diff --git a/jwt/contrib/algorithms/pycrypto.py b/jwt/contrib/algorithms/pycrypto.py index e6afaa5..fe477db 100644 --- a/jwt/contrib/algorithms/pycrypto.py +++ b/jwt/contrib/algorithms/pycrypto.py @@ -7,6 +7,7 @@ from Crypto.Signature import PKCS1_v1_5 from jwt.algorithms import Algorithm from jwt.compat import string_types, text_type +from jwt.exceptions import InvalidAsymmetricKeyError class RSAAlgorithm(Algorithm): @@ -36,7 +37,7 @@ class RSAAlgorithm(Algorithm): key = RSA.importKey(key) else: - raise TypeError('Expecting a PEM- or RSA-formatted key.') + raise InvalidAsymmetricKeyError return key |