better recievemessage
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Torma Kristóf 2021-04-25 18:18:37 +02:00
parent 89e8bd1295
commit 5378ec8cdc
Signed by: tormakris
GPG Key ID: DC83C4F2C41B1047

View File

@ -127,7 +127,12 @@ class NetWrapper:
def recieveEncryptedMessage(self, msg: bytes) -> bytes:
try:
b64 = json.loads(msg)
b64 = json.loads(msg.decode('UTF-8'))
while not (b64['source'] == self.clientAddr and b64['type'] == 'CMD'):
status, msg = self.network.receive_msg(blocking=True)
if not status:
raise Exception('Network error during connection.')
b64 = json.loads(msg.decode('UTF-8'))
retnonce = b64decode(b64['nonce'])
retciphertext = b64decode(b64['message'])
retcipher = ChaCha20.new(self.cipherkey, nonce=retnonce)