diff --git a/client/netwrapper.py b/client/netwrapper.py index 51c7839..dfb8219 100644 --- a/client/netwrapper.py +++ b/client/netwrapper.py @@ -66,7 +66,7 @@ class NetWrapper: def authenticate(self, password: str): message = f"LIN {self.username} {password}".encode('UTF-8') - cipher = ChaCha20.new(self.cipherkey, get_random_bytes(12)) + cipher = ChaCha20.new(key=self.cipherkey, nonce=get_random_bytes(12)) ciphertext = cipher.encrypt(message) nonce = b64encode(cipher.nonce).decode('ASCII') ct = b64encode(ciphertext).decode('ASCII') @@ -101,7 +101,7 @@ class NetWrapper: def sendMessage(self, message: bytes): - cipher = ChaCha20.new(self.cipherkey, get_random_bytes(12)) + cipher = ChaCha20.new(key=self.cipherkey, nonce=get_random_bytes(12)) ciphertext = cipher.encrypt(message) nonce = b64encode(cipher.nonce).decode('ASCII') ct = b64encode(ciphertext).decode('ASCII') @@ -120,7 +120,7 @@ class NetWrapper: try: retnonce = b64decode(b64['nonce']) retciphertext = b64decode(b64['message']) - retcipher = ChaCha20.new(self.cipherkey, nonce=retnonce) + retcipher = ChaCha20.new(key=self.cipherkey, nonce=retnonce) plaintext = retcipher.decrypt(retciphertext) return plaintext except Exception: