This commit is contained in:
parent
89e8bd1295
commit
5378ec8cdc
@ -127,7 +127,12 @@ class NetWrapper:
|
|||||||
|
|
||||||
def recieveEncryptedMessage(self, msg: bytes) -> bytes:
|
def recieveEncryptedMessage(self, msg: bytes) -> bytes:
|
||||||
try:
|
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'])
|
retnonce = b64decode(b64['nonce'])
|
||||||
retciphertext = b64decode(b64['message'])
|
retciphertext = b64decode(b64['message'])
|
||||||
retcipher = ChaCha20.new(self.cipherkey, nonce=retnonce)
|
retcipher = ChaCha20.new(self.cipherkey, nonce=retnonce)
|
||||||
|
Loading…
Reference in New Issue
Block a user