P2 finito tout marche p5
This commit is contained in:
parent
9e2fd37838
commit
1ffdf6eca1
2 changed files with 9 additions and 1 deletions
|
@ -1,16 +1,20 @@
|
|||
from flask import *
|
||||
import ssl
|
||||
import requests
|
||||
import rsa
|
||||
import urllib3
|
||||
|
||||
# Open public key of the server
|
||||
with open("ssl/server_public.pem","r") as f_public:
|
||||
pubi_k = rsa.PublicKey.load_pkcs1(f_public.read())
|
||||
|
||||
message = "Hello World !".encode()
|
||||
# Encrypt the message with the public key of the server
|
||||
encrypt_message= rsa.encrypt(message,pubi_k)
|
||||
|
||||
# Delete error in the terminal
|
||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
||||
|
||||
# Send the request
|
||||
response = requests.post('https://localhost:5000/data',data=encrypt_message, verify="ssl/CA.crt")
|
||||
|
||||
print(response.json())
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue