Skip to content

Commit d6d2b30

Browse files
committed
import rsa backends with backend-explicit naming to avoid confusion
1 parent b4d6ca2 commit d6d2b30

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

tests/algorithms/test_RSA.py

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
11
import sys
22

33
try:
4-
from Crypto.PublicKey import RSA
4+
from Crypto.PublicKey import RSA as PyCryptoRSA
55
except ImportError:
6-
RSA = None
6+
PyCryptoRSA = None
77

88
try:
99
from cryptography.hazmat.backends import default_backend
10-
from cryptography.hazmat.primitives.asymmetric import rsa
10+
from cryptography.hazmat.primitives.asymmetric import rsa as pyca_rsa
1111
except ImportError:
12-
default_backend = rsa = None
12+
default_backend = pyca_rsa = None
1313

1414
from jose.backends import RSAKey
1515
from jose.constants import ALGORITHMS
@@ -77,9 +77,9 @@
7777

7878
@pytest.mark.pycrypto
7979
@pytest.mark.pycryptodome
80-
@pytest.mark.skipif(RSA is None, reason="Pycrypto/dome backend not available")
80+
@pytest.mark.skipif(PyCryptoRSA is None, reason="Pycrypto/dome backend not available")
8181
def test_pycrypto_RSA_key_instance():
82-
key = RSA.construct((long(
82+
key = PyCryptoRSA.construct((long(
8383
26057131595212989515105618545799160306093557851986992545257129318694524535510983041068168825614868056510242030438003863929818932202262132630250203397069801217463517914103389095129323580576852108653940669240896817348477800490303630912852266209307160550655497615975529276169196271699168537716821419779900117025818140018436554173242441334827711966499484119233207097432165756707507563413323850255548329534279691658369466534587631102538061857114141268972476680597988266772849780811214198186940677291891818952682545840788356616771009013059992237747149380197028452160324144544057074406611859615973035412993832273216732343819),
8484
long(65537)))
8585
RSAKey(key, ALGORITHMS.RS256)
@@ -99,12 +99,12 @@ def test_pycrypto_unencoded_cleartext():
9999

100100
@pytest.mark.cryptography
101101
@pytest.mark.skipif(
102-
None in (default_backend, rsa),
102+
None in (default_backend, pyca_rsa),
103103
reason="Cryptography backend not available"
104104
)
105105
def test_cryptography_RSA_key_instance():
106106

107-
key = rsa.RSAPublicNumbers(
107+
key = pyca_rsa.RSAPublicNumbers(
108108
long(65537),
109109
long(26057131595212989515105618545799160306093557851986992545257129318694524535510983041068168825614868056510242030438003863929818932202262132630250203397069801217463517914103389095129323580576852108653940669240896817348477800490303630912852266209307160550655497615975529276169196271699168537716821419779900117025818140018436554173242441334827711966499484119233207097432165756707507563413323850255548329534279691658369466534587631102538061857114141268972476680597988266772849780811214198186940677291891818952682545840788356616771009013059992237747149380197028452160324144544057074406611859615973035412993832273216732343819),
110110
).public_key(default_backend())

0 commit comments

Comments
 (0)