Skip to content

Commit

Permalink
Pass only byte strings to pycryptodome
Browse files Browse the repository at this point in the history
Only pass unicode encoded string to pycryptodome
  • Loading branch information
thallada committed Dec 20, 2017
1 parent aaf80d1 commit 83ba9ab
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion edx_proctoring/backends/software_secure.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 83ba9ab

Please sign in to comment.