From aaf80d17401382331507efaea7ad2496418dee05 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Wed, 20 Dec 2017 17:20:39 -0500 Subject: [PATCH 1/3] Switch from pycypto to pycryptodomex I suspect this might fix LEARNER-3705 because pycrypto was removed in edx-platform by https://github.com/edx/edx-platform/pull/16612. Regardless, PyCryptodome is more maintained than PyCrypto. --- edx_proctoring/backends/software_secure.py | 2 +- requirements/base.in | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/edx_proctoring/backends/software_secure.py b/edx_proctoring/backends/software_secure.py index 3feaa69120c..dfa88a023a9 100644 --- a/edx_proctoring/backends/software_secure.py +++ b/edx_proctoring/backends/software_secure.py @@ -17,7 +17,7 @@ from django.conf import settings -from Crypto.Cipher import DES3 +from Cryptodome.Cipher import DES3 from edx_proctoring.backends.backend import ProctoringBackendProvider from edx_proctoring import constants diff --git a/requirements/base.in b/requirements/base.in index 7a47d0edba1..15eb1658a26 100644 --- a/requirements/base.in +++ b/requirements/base.in @@ -6,7 +6,7 @@ django-model-utils>=2.3.1 djangorestframework>=3.1,<3.7 django-ipware>=1.1.0 pytz>=2012h -pycrypto>=2.6 +pycryptodomex>=3.4.7 python-dateutil>=2.1 # edX packages From 83ba9ab937b4c1825336c1bcc0b9ad4ba66ce5d2 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Wed, 20 Dec 2017 17:38:11 -0500 Subject: [PATCH 2/3] Pass only byte strings to pycryptodome Only pass unicode encoded string to pycryptodome --- edx_proctoring/backends/software_secure.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/edx_proctoring/backends/software_secure.py b/edx_proctoring/backends/software_secure.py index dfa88a023a9..babda446d19 100644 --- a/edx_proctoring/backends/software_secure.py +++ b/edx_proctoring/backends/software_secure.py @@ -337,7 +337,8 @@ def pad(text): """ Apply padding """ - return text + (block_size - len(text) % block_size) * chr(block_size - len(text) % block_size) + return (text + (block_size - len(text) % block_size) * + chr(block_size - len(text) % block_size)).encode('utf-8') cipher = DES3.new(key, DES3.MODE_ECB) encrypted_text = cipher.encrypt(pad(pwd)) return base64.b64encode(encrypted_text) From 1894ddefb13a05a881e798c6b5c3233bc3cf4378 Mon Sep 17 00:00:00 2001 From: Tyler Hallada Date: Wed, 20 Dec 2017 17:26:57 -0500 Subject: [PATCH 3/3] Bump version to 1.3.3 --- edx_proctoring/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/edx_proctoring/__init__.py b/edx_proctoring/__init__.py index 0741a25f550..5741eb47065 100644 --- a/edx_proctoring/__init__.py +++ b/edx_proctoring/__init__.py @@ -4,6 +4,6 @@ from __future__ import absolute_import -__version__ = '1.3.2' +__version__ = '1.3.3' default_app_config = 'edx_proctoring.apps.EdxProctoringConfig' # pylint: disable=invalid-name