rienkimarche
This commit is contained in:
parent
89e7d1c28d
commit
d71ca0efbc
1 changed files with 19 additions and 4 deletions
|
@ -1,10 +1,25 @@
|
||||||
from flask import *
|
from flask import *
|
||||||
import ssl
|
import ssl
|
||||||
import requests
|
import requests
|
||||||
from Crypto import RSA
|
import rsa
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
data = 'Hello World !'
|
data = 'Hello World !'
|
||||||
requests.post('https://localhost:5000',data)
|
|
||||||
|
|
||||||
|
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)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue