-
Notifications
You must be signed in to change notification settings - Fork 238
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #122 from mattsb42-aws/pyca-default
make cryptography_backend the default for RSAKey
- Loading branch information
Showing
3 changed files
with
39 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
"""Test the default import handling.""" | ||
try: | ||
from jose.backends.rsa_backend import RSAKey as PurePythonRSAKey | ||
except ImportError: | ||
PurePythonRSAKey = None | ||
try: | ||
from jose.backends.cryptography_backend import CryptographyRSAKey, CryptographyECKey | ||
except ImportError: | ||
CryptographyRSAKey = CryptographyECKey = None | ||
try: | ||
from jose.backends.pycrypto_backend import RSAKey as PyCryptoRSAKey | ||
except ImportError: | ||
PyCryptoRSAKey = None | ||
try: | ||
from jose.backends.ecdsa_backend import ECDSAECKey as PurePythonECDSAKey | ||
except ImportError: | ||
PurePythonRSAKey = None | ||
|
||
from jose.backends import ECKey, RSAKey | ||
|
||
|
||
def test_default_ec_backend(): | ||
if CryptographyECKey is not None: | ||
assert ECKey is CryptographyECKey | ||
else: | ||
assert ECKey is PurePythonECDSAKey | ||
|
||
|
||
def test_default_rsa_backend(): | ||
if CryptographyRSAKey is not None: | ||
assert RSAKey is CryptographyRSAKey | ||
elif PyCryptoRSAKey is not None: | ||
assert RSAKey is PyCryptoRSAKey | ||
else: | ||
assert RSAKey is PurePythonRSAKey |