|
5 | 5 | from .exceptions import InvalidKeyError
|
6 | 6 |
|
7 | 7 | try:
|
8 |
| - from cryptography.hazmat.primitives import interfaces, hashes |
| 8 | + from cryptography.hazmat.primitives import hashes |
9 | 9 | from cryptography.hazmat.primitives.serialization import (
|
10 | 10 | load_pem_private_key, load_pem_public_key, load_ssh_public_key
|
11 | 11 | )
|
| 12 | + from cryptography.hazmat.primitives.asymmetric.rsa import ( |
| 13 | + RSAPrivateKey, RSAPublicKey |
| 14 | + ) |
| 15 | + from cryptography.hazmat.primitives.asymmetric.ec import ( |
| 16 | + EllipticCurvePrivateKey, EllipticCurvePublicKey |
| 17 | + ) |
12 | 18 | from cryptography.hazmat.primitives.asymmetric import ec, padding
|
13 | 19 | from cryptography.hazmat.backends import default_backend
|
14 | 20 | from cryptography.exceptions import InvalidSignature
|
@@ -142,8 +148,8 @@ def __init__(self, hash_alg):
|
142 | 148 | self.hash_alg = hash_alg()
|
143 | 149 |
|
144 | 150 | def prepare_key(self, key):
|
145 |
| - if isinstance(key, interfaces.RSAPrivateKey) or \ |
146 |
| - isinstance(key, interfaces.RSAPublicKey): |
| 151 | + if isinstance(key, RSAPrivateKey) or \ |
| 152 | + isinstance(key, RSAPublicKey): |
147 | 153 | return key
|
148 | 154 |
|
149 | 155 | if isinstance(key, string_types):
|
@@ -199,8 +205,8 @@ def __init__(self, hash_alg):
|
199 | 205 | self.hash_alg = hash_alg()
|
200 | 206 |
|
201 | 207 | def prepare_key(self, key):
|
202 |
| - if isinstance(key, interfaces.EllipticCurvePrivateKey) or \ |
203 |
| - isinstance(key, interfaces.EllipticCurvePublicKey): |
| 208 | + if isinstance(key, EllipticCurvePrivateKey) or \ |
| 209 | + isinstance(key, EllipticCurvePublicKey): |
204 | 210 | return key
|
205 | 211 |
|
206 | 212 | if isinstance(key, string_types):
|
|
0 commit comments