I managed to program an http web server to run python script. Now I need to implement encryption. In the code below I already do the handshake between the client and the server. Where the client sends the version of (TLS) and the message (Client Hello). I’ve already generated the Certificate and the public and private keys, but I’m having trouble understanding and coding. Can someone give me a help ?
# Native module : socketserver -> https://docs.python.org/3/library/socketserver.html#module-socketserver
from socketserver import BaseRequestHandler, ThreadingTCPServer
# Native module : ssl -> https://docs.python.org/3/library/ssl.html#module-ssl
import ssl
class TCPIPV4HTTPS(BaseRequestHandler):
pass
class TLSProtocol():
pass
if __name__ == "__main__":
HOST, PORT = "", 443
# Create the asynchronous server, binding to localhost on port 443
with ThreadingTCPServer((HOST, PORT), TCPIPV4HTTPS.TLSProtocol) as https:
# print("Server : Action v0.0.1, running address http://webstrucs.com:443")
# print("cancel program with Ctrl-C")
https.serve_forever()