This commit is contained in:
parent
58606caf3f
commit
e8ab5d0ddd
@ -76,13 +76,11 @@ class NetWrapper:
|
|||||||
sendjson = json.dumps({'header': b64encode(header).decode('UTF-8'), 'nonce': nonce, 'message': ct, 'tag': b64tag}).encode(
|
sendjson = json.dumps({'header': b64encode(header).decode('UTF-8'), 'nonce': nonce, 'message': ct, 'tag': b64tag}).encode(
|
||||||
'UTF-8')
|
'UTF-8')
|
||||||
self.network.send_msg(self.serverAddr, sendjson)
|
self.network.send_msg(self.serverAddr, sendjson)
|
||||||
b64 = {'source': '', 'type': ''}
|
try:
|
||||||
while not (b64['source'] == self.serverAddr and b64['type'] == 'AUT'):
|
|
||||||
status, msg = self.network.receive_msg(blocking=True)
|
status, msg = self.network.receive_msg(blocking=True)
|
||||||
if not status:
|
if not status:
|
||||||
raise Exception('Network error during connection.')
|
raise Exception('Network error during connection.')
|
||||||
b64 = json.loads(msg.decode('UTF-8'))
|
b64 = json.loads(msg.decode('UTF-8'))
|
||||||
try:
|
|
||||||
retnonce = b64decode(b64['nonce'])
|
retnonce = b64decode(b64['nonce'])
|
||||||
retciphertext = b64decode(b64['message'])
|
retciphertext = b64decode(b64['message'])
|
||||||
retcipher = ChaCha20_Poly1305.new(key=self.cipherkey, nonce=retnonce)
|
retcipher = ChaCha20_Poly1305.new(key=self.cipherkey, nonce=retnonce)
|
||||||
|
Loading…
Reference in New Issue
Block a user