25 lines
658 B
Python
25 lines
658 B
Python
from flask import *
|
|
import ssl
|
|
import requests
|
|
import rsa
|
|
|
|
data = 'Hello World !'
|
|
|
|
with open("../server/ssl/public.key", "rb") as public_serv_file:
|
|
public_serv = public_serv_file.read()
|
|
|
|
with open("ssl/id_rsa", "rb") as private_key_file:
|
|
private_key = private_key_file.read()
|
|
|
|
public_key_serv = rsa.PublicKey.load_pkcs1(public_serv)
|
|
private_key_client = rsa.PrivateKey.load_pkcs1(private_key)
|
|
|
|
|
|
crypt = rsa.encrypt(data.encode(), public_key_serv)
|
|
|
|
# Afficher le message original (pour vérification)
|
|
print(data)
|
|
|
|
response = requests.post('https://localhost:5000', data={'message': crypt, 'signature': signature}, verify=False)
|
|
|
|
#print(response.text)
|