Compare commits

..

No commits in common. "70a5ec32cc4c02e896880061122d015d1d295d91" and "92cccd1799fbe337bb2743cab155e26ab79b4363" have entirely different histories.

6 changed files with 23 additions and 28 deletions

View file

@ -2,4 +2,4 @@ FROM python:alpine
WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
CMD ["python", "main.py"]
CMD ["python", "client.py"]

View file

@ -1,3 +1,2 @@
flask==3.1.0
pyopenssl==25.0.0
requests==2.26.0
pyopenssl==25.0.0

20
RSA/server/__init__.py Normal file
View file

@ -0,0 +1,20 @@
import ssl
from flask import *
import flask_wtf as wtf
print(ssl.OPENSSL_VERSION)
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain(certfile='ssl/CA.crt', keyfile='ssl/CA.key')
app= Flask(__name__)
@app.route("/")
def index():
return render_template("index.html")
@app.route('/data', methods=['POST'])
def receiv():
encrypted_data = request.form['data']
if __name__ == "__main__":
app.run(ssl_context=context)

View file

@ -3,6 +3,5 @@ WORKDIR /app
COPY . .
RUN pip install -r requirements.txt
EXPOSE 80
EXPOSE 443
EXPOSE 5000
CMD ["python", "main.py"]
CMD ["python", "__init__.py"]

View file

@ -1,23 +0,0 @@
import ssl
from flask import Flask, render_template, request
app = Flask(__name__)
app.config['SECRET_KEY'] = 'your_secret_key_here' # Required for Flask-WTF
# SSL Configuration
context = ssl.SSLContext(ssl.PROTOCOL_TLS_SERVER)
context.load_cert_chain(certfile='ssl/CA.crt', keyfile='ssl/CA.key')
@app.route("/")
def index():
return render_template("index.html")
@app.route('/data', methods=['POST'])
def receive():
encrypted_data = request.form.get('data', None) # Safely get form data
if encrypted_data:
return f"Received encrypted data: {encrypted_data}", 200
return "No data received", 400
if __name__ == "__main__":
app.run(ssl_context=context, host='0.0.0.0', port=5000) # Allow external access