1 changed files with 31 additions and 0 deletions
@ -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() |
|||
Loading…
Reference in new issue