Hotfix from crypto

This commit is contained in:
Itay Mizeretz 2019-02-11 14:07:49 +02:00
parent 0437f7be9b
commit 99043fb8cf
1 changed files with 1 additions and 1 deletions

View File

@ -39,7 +39,7 @@ class Encryptor:
def enc(self, message): def enc(self, message):
cipher_iv = Random.new().read(AES.block_size) cipher_iv = Random.new().read(AES.block_size)
cipher = AES.new(self._cipher_key, AES.MODE_CBC, cipher_iv) cipher = AES.new(self._cipher_key, AES.MODE_CBC, cipher_iv)
return base64.b64encode(cipher_iv + cipher.encrypt(self._pad(message))) return base64.b64encode(cipher_iv + cipher.encrypt(str(self._pad(message)))) # ciper.encrypt expects str
def dec(self, enc_message): def dec(self, enc_message):
enc_message = base64.b64decode(enc_message) enc_message = base64.b64decode(enc_message)