P2 finito tout marche p5

This commit is contained in:
vSpaike 2025-01-25 01:11:26 +01:00
parent 9e2fd37838
commit 1ffdf6eca1
2 changed files with 9 additions and 1 deletions

View file

@ -18,10 +18,14 @@ def index():
@app.route('/data', methods=['POST'])
def receive():
try:
# Receive message from the client
encrypted_message = request.data
# Open our private key
with open("ssl/server_private.pem","r") as f_public:
pubi_k = rsa.PrivateKey.load_pkcs1(f_public.read())
# Decrypt the message and post-it
decrypt_message = rsa.decrypt(encrypted_message,pubi_k).decode()
print("Message received :",decrypt_message)
return jsonify({'status': 'success', 'decrypted_message': decrypt_message}), 200