arp-spoofing/RSA/client/main.py
2025-01-25 01:08:15 +01:00

27 lines
No EOL
721 B
Python

from flask import *
import ssl
import requests
import rsa
import urllib3
with open("ssl/server_public.pem","r") as f_public:
pubi_k = rsa.PublicKey.load_pkcs1(f_public.read())
message = "Hello World !".encode()
encrypt_message= rsa.encrypt(message,pubi_k)
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
response = requests.post('https://localhost:5000/data',data=encrypt_message, verify="ssl/CA.crt")
print(response.json())
'''
Generation clef
(public_key, private_key) = rsa.newkeys(4096)
with open("ssl/public.pem", "wb") as pub_file:
pub_file.write(public_key.save_pkcs1("PEM"))
with open("ssl/private.pem", "wb") as priv_file:
priv_file.write(private_key.save_pkcs1("PEM"))
'''