def create_https_server(): node_cert_path = ssl.get_cert_path(SERVER_NODE_NAME) ca_root_path = ssl.get_cert_path('ca_root') key_path = ssl.get_key_path(SERVER_NODE_NAME) ctx = make_context(ca_root_path, node_cert_path, key_path) server = HTTPSServer( (LISTEN_ADDRESS, LISTEN_PORT), TestHTTPRequestHandler, ctx ) return server
def create_client_ssl_context(): node_cert_path = ssl.get_cert_path(CLIENT_NODE_NAME) ca_root_path = ssl.get_cert_path('ca_root') key_path = ssl.get_key_path(CLIENT_NODE_NAME) ctx = make_context(ca_root_path, node_cert_path, key_path, mode='client') return ctx