forked from p15670423/monkey
Hotfix from crypto
This commit is contained in:
parent
0437f7be9b
commit
99043fb8cf
|
@ -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)
|
||||||
|
|
Loading…
Reference in New Issue