aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'dev-python/keyrings_alt/files/keyrings_alt-4.1.0-pycryptodome.patch')
-rw-r--r--dev-python/keyrings_alt/files/keyrings_alt-4.1.0-pycryptodome.patch90
1 files changed, 0 insertions, 90 deletions
diff --git a/dev-python/keyrings_alt/files/keyrings_alt-4.1.0-pycryptodome.patch b/dev-python/keyrings_alt/files/keyrings_alt-4.1.0-pycryptodome.patch
deleted file mode 100644
index e0ca3a012..000000000
--- a/dev-python/keyrings_alt/files/keyrings_alt-4.1.0-pycryptodome.patch
+++ /dev/null
@@ -1,90 +0,0 @@
-diff --git a/keyrings/alt/file.py b/keyrings/alt/file.py
-index 37c837f..866e8d0 100644
---- a/keyrings/alt/file.py
-+++ b/keyrings/alt/file.py
-@@ -44,8 +44,12 @@ class Encrypted:
- """
- Create the cipher object to encrypt or decrypt a payload.
- """
-- from Cryptodome.Protocol.KDF import PBKDF2
-- from Cryptodome.Cipher import AES
-+ try:
-+ from Cryptodome.Protocol.KDF import PBKDF2
-+ from Cryptodome.Cipher import AES
-+ except ImportError:
-+ from Crypto.Protocol.KDF import PBKDF2
-+ from Crypto.Cipher import AES
-
- pw = PBKDF2(password, salt, dkLen=self.block_size)
- return AES.new(pw[: self.block_size], AES.MODE_CFB, IV)
-@@ -79,7 +83,12 @@ class EncryptedKeyring(Encrypted, Keyring):
- __import__('Cryptodome.Protocol.KDF')
- __import__('Cryptodome.Random')
- except ImportError: # pragma: no cover
-- raise RuntimeError("pycryptodomex required")
-+ try:
-+ __import__('Crypto.Cipher.AES')
-+ __import__('Crypto.Protocol.KDF')
-+ __import__('Crypto.Random')
-+ except ImportError:
-+ raise RuntimeError("pycryptodomex or pycryptodome required")
- if not json: # pragma: no cover
- raise RuntimeError("JSON implementation such as simplejson required.")
- return 0.6
-@@ -190,10 +199,16 @@ class EncryptedKeyring(Encrypted, Keyring):
-
- def encrypt(self, password, assoc=None):
- # encrypt password, ignore associated data
-- from Cryptodome.Random import get_random_bytes
-+ try:
-+ from Cryptodome.Random import get_random_bytes
-+ except ImportError:
-+ from Crypto.Random import get_random_bytes
-
- salt = get_random_bytes(self.block_size)
-- from Cryptodome.Cipher import AES
-+ try:
-+ from Cryptodome.Cipher import AES
-+ except ImportError:
-+ from Crypto.Cipher import AES
-
- IV = get_random_bytes(AES.block_size)
- cipher = self._create_cipher(self.keyring_key, salt, IV)
-diff --git a/tests/test_crypto.py b/tests/test_crypto.py
-index cfc782a..7396023 100644
---- a/tests/test_crypto.py
-+++ b/tests/test_crypto.py
-@@ -14,7 +14,12 @@ def is_crypto_supported():
- __import__('Cryptodome.Protocol.KDF')
- __import__('Cryptodome.Random')
- except ImportError:
-- return False
-+ try:
-+ __import__('Crypto.Cipher.AES')
-+ __import__('Crypto.Protocol.KDF')
-+ __import__('Crypto.Random')
-+ except ImportError:
-+ return False
- return True
-
-
-diff --git a/tests/test_file.py b/tests/test_file.py
-index 62192da..3f813f0 100644
---- a/tests/test_file.py
-+++ b/tests/test_file.py
-@@ -157,7 +157,14 @@ class FileKeyringTests(BackendBasicTests):
- class TestEncryptedFileKeyring(FileKeyringTests):
- @pytest.fixture(autouse=True)
- def crypt_fixture(self, monkeypatch):
-- pytest.importorskip('Cryptodome')
-+ try:
-+ import Cryptodome
-+ except ImportError:
-+ try:
-+ import Crypto
-+ except ImportError:
-+ pytest.skip("Neither pycryptodome nor pycryptodomex are available",
-+ allow_module_level=True)
- fake_getpass = mock.Mock(return_value='abcdef')
- monkeypatch.setattr(getpass, 'getpass', fake_getpass)
-