From 942a4e6076acb7e091501dc5ae76ec14df39e63a Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Wed, 18 Oct 2017 17:24:21 +0100 Subject: [PATCH 1/4] Remove unecessary dependencies from setup.py --- setup.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/setup.py b/setup.py index 1422d43..0563056 100644 --- a/setup.py +++ b/setup.py @@ -14,9 +14,6 @@ install_requires=[ 'django', 'pycrypto', - 'nose', - 'django-nose==1.4.4', - 'tox', ], classifiers=[ 'Development Status :: 2 - Pre-Alpha', From 9c92aec29d407badc9cb62f70f5f71230374a08e Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Mon, 25 Mar 2019 17:12:16 +0000 Subject: [PATCH 2/4] Update setup.py Use pycryptodome instead of pycrypto --- setup.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/setup.py b/setup.py index 0563056..394ca8f 100644 --- a/setup.py +++ b/setup.py @@ -13,7 +13,7 @@ url='http://github.com/svetlyak40wt/django-fields/', install_requires=[ 'django', - 'pycrypto', + 'pycryptodome', ], classifiers=[ 'Development Status :: 2 - Pre-Alpha', From 8c5195f1ad6611460e9c1b83a4c406d604362efd Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Tue, 26 Mar 2019 09:28:17 +0000 Subject: [PATCH 3/4] Pass CBC mode when block type not specified --- src/django_fields/fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/django_fields/fields.py b/src/django_fields/fields.py index 3611510..51ae22f 100644 --- a/src/django_fields/fields.py +++ b/src/django_fields/fields.py @@ -66,7 +66,7 @@ def __init__(self, *args, **kwargs): getattr(self.cipher_object, self.block_type), self.iv) else: - self.cipher = self.cipher_object.new(self.secret_key) + self.cipher = self.cipher_object.new(self.secret_key, self.cipher_object.MODE_CBC) self.prefix = '$%s$' % self.cipher_type self.original_max_length = max_length = kwargs.get('max_length', 40) From 273648b170d464a5a665108c035b7b679f086738 Mon Sep 17 00:00:00 2001 From: James Sharpe Date: Tue, 26 Mar 2019 09:29:43 +0000 Subject: [PATCH 4/4] EBC is the default in Pycrypto so set it to this if not specified --- src/django_fields/fields.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/django_fields/fields.py b/src/django_fields/fields.py index 51ae22f..4b3b17f 100644 --- a/src/django_fields/fields.py +++ b/src/django_fields/fields.py @@ -66,7 +66,7 @@ def __init__(self, *args, **kwargs): getattr(self.cipher_object, self.block_type), self.iv) else: - self.cipher = self.cipher_object.new(self.secret_key, self.cipher_object.MODE_CBC) + self.cipher = self.cipher_object.new(self.secret_key, self.cipher_object.MODE_ECB) self.prefix = '$%s$' % self.cipher_type self.original_max_length = max_length = kwargs.get('max_length', 40)