summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJosé Padilla <jpadilla@webapplicate.com>2015-03-18 12:35:26 -0400
committerJosé Padilla <jpadilla@webapplicate.com>2015-03-18 12:35:26 -0400
commit3cc2e998a84a8cd6e5a0c4e67caf038d337458d8 (patch)
tree44ad2e4ad1c7b6595d190a26d677b53d603914ca
parentce3e84e7a9ceef46b0f71ca7ce7428e8619e892b (diff)
parent8e69483435d61e6b04087878aa5d47a0314eaca0 (diff)
downloadpyjwt-1.0.0.tar.gz
Merge pull request #113 from mark-adams/fix-crypto-warnings1.0.0
Fixed some DeprecationWarnings related to our cryptography 0.8 upgrade
-rw-r--r--README.md2
-rw-r--r--jwt/algorithms.py16
2 files changed, 12 insertions, 6 deletions
diff --git a/README.md b/README.md
index 9309b95..167f78e 100644
--- a/README.md
+++ b/README.md
@@ -15,7 +15,7 @@ $ pip install PyJWT
**A Note on Dependencies**:
-RSA and ECDSA signatures depend on the recommended `cryptography` package. If you plan on
+RSA and ECDSA signatures depend on the recommended `cryptography` package (0.8+). If you plan on
using any of those algorithms, you'll need to install it as well.
```
diff --git a/jwt/algorithms.py b/jwt/algorithms.py
index 4a40cfb..cda7b19 100644
--- a/jwt/algorithms.py
+++ b/jwt/algorithms.py
@@ -5,10 +5,16 @@ from .compat import constant_time_compare, string_types, text_type
from .exceptions import InvalidKeyError
try:
- from cryptography.hazmat.primitives import interfaces, hashes
+ from cryptography.hazmat.primitives import hashes
from cryptography.hazmat.primitives.serialization import (
load_pem_private_key, load_pem_public_key, load_ssh_public_key
)
+ from cryptography.hazmat.primitives.asymmetric.rsa import (
+ RSAPrivateKey, RSAPublicKey
+ )
+ from cryptography.hazmat.primitives.asymmetric.ec import (
+ EllipticCurvePrivateKey, EllipticCurvePublicKey
+ )
from cryptography.hazmat.primitives.asymmetric import ec, padding
from cryptography.hazmat.backends import default_backend
from cryptography.exceptions import InvalidSignature
@@ -142,8 +148,8 @@ if has_crypto:
self.hash_alg = hash_alg()
def prepare_key(self, key):
- if isinstance(key, interfaces.RSAPrivateKey) or \
- isinstance(key, interfaces.RSAPublicKey):
+ if isinstance(key, RSAPrivateKey) or \
+ isinstance(key, RSAPublicKey):
return key
if isinstance(key, string_types):
@@ -199,8 +205,8 @@ if has_crypto:
self.hash_alg = hash_alg()
def prepare_key(self, key):
- if isinstance(key, interfaces.EllipticCurvePrivateKey) or \
- isinstance(key, interfaces.EllipticCurvePublicKey):
+ if isinstance(key, EllipticCurvePrivateKey) or \
+ isinstance(key, EllipticCurvePublicKey):
return key
if isinstance(key, string_types):