From db668879c56197182458a68b589fda76aa98300e Mon Sep 17 00:00:00 2001 From: "enora.delmas" <> Date: Mon, 18 May 2026 10:27:57 +0200 Subject: [PATCH] ajout --- InterfaceClient.py | 31 +++++++++++++++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 InterfaceClient.py diff --git a/InterfaceClient.py b/InterfaceClient.py new file mode 100644 index 0000000..fba01b7 --- /dev/null +++ b/InterfaceClient.py @@ -0,0 +1,31 @@ +# -*- coding: utf-8 -*- + +import tkinter as tk +from random import randint +from Interface import Interface + + +class InterfaceClient(Interface): + def __init__(self): + Interface.__init__(self, "client") + self.helloButton = tk.Button(self, text="Hello", command=self.hello) + self.helloButton.pack() + self.keyButton = tk.Button(self, text="KeyExchange", command=keyexchange) + self.keyButton.pack() + + def hello(self): + "envoie le message HELLO" + self.connexion.send("HELLO") + + def keyexchange(self): + """attend la clé publique du serveur, choisis une clé symétrique aleatoire de 7 +caractères, la transmet en la chiffrant avec la clé publique du sevreur puis attend le message Finished""" + cle_publique = self.connexion.recv() + cle_symetrique = "" + for i in range(7): + chiffre = randint(1, 256) + cle_symetrique += chr(chiffre) + + +It = InterfaceClient() +It.mainloop()