From d7aec65c2a5f5c071dd7d78df169abe6a715b8b5 Mon Sep 17 00:00:00 2001
From: Dominik Fuhrmann <dominik.fuhrmann1@gmail.com>
Date: Fri, 27 Dec 2024 10:31:02 +0100
Subject: [PATCH] new server

---
 communication/client.py | 2 +-
 communication/server.py | 8 ++++----
 2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/communication/client.py b/communication/client.py
index c2b9c65..ef53a9e 100644
--- a/communication/client.py
+++ b/communication/client.py
@@ -79,7 +79,7 @@ def main():
     configure_logging()
     
     # server information
-    host = '192.168.178.51'
+    host = '192.168.178.63'
     port = 12345
     
     # Load RSA public key (for encrypting the key)
diff --git a/communication/server.py b/communication/server.py
index 2523449..4348f70 100644
--- a/communication/server.py
+++ b/communication/server.py
@@ -21,7 +21,7 @@ def load_private_key():
 def decrypt_key_with_rsa(private_key, encrypted_key):
     cipher = PKCS1_OAEP.new(private_key)
     key = cipher.decrypt(encrypted_key)
-    logging.info(f"Decrypted key: {key.hex()}")
+    logging.info(f"Decrypted RSA key: {key.hex()}")
     return key
 
 # Decrypt received message using the key, depending on algorithm
@@ -75,15 +75,14 @@ def handle_client(conn, addr, private_key):
         encrypted_key = base64.b64decode(data['encrypted_key'])
         encrypted_message = data['encrypted_message']
         logging.info(f"Algorithm: {algorithm}, Key Length: {key_length}")
-        user_input(f"Received data from client {addr}: Algorithm: {algorithm}, Key Length: {key_length}, Encrypted message: {encrypted_message}")
     except json.JSONDecodeError as e:
         logging.error(f"Error decoding data: {e}")
         conn.close()
         return
     
     # Decrypt the key using RSA
+    logging.info(f"Decrypted RSA key from client {addr}.")
     key = decrypt_key_with_rsa(private_key, encrypted_key)
-    logging.info(f"Decrypted key from client {addr}.")
     
     # Decrypt the message using the key
     decrypted_message = decrypt_message(algorithm, key, encrypted_message)
@@ -103,7 +102,7 @@ def main():
     configure_logging()
     
     # server information
-    host = '192.168.178.51'
+    host = '192.168.178.63'
     port = 12345
     
     # Load RSA private key (for decrypting the key)
@@ -125,6 +124,7 @@ def main():
         while True:
             try:
                 conn, addr = s.accept()
+                logging.info("\n")
                 logging.info(f"Connection from {addr}")
                 handle_client(conn, addr, private_key)
                 conn.close()
-- 
GitLab