Send an TLS Alert to an SSL socket in Python -


i wrote server in python3 makes use of ssl. if client connects , sends invalid request, want terminate ssl connection tls alert internal error.

this minimal example of have in mind:

#!/usr/bin/env python3  import socket,ssl  s = socket.socket(socket.af_inet, socket.sock_stream) s.setsockopt(socket.sol_socket, socket.so_reuseaddr, 1) s.bind(('0.0.0.0',1234)) s.listen() s, addr = s.accept()  s = ssl.wrap_socket(     s,     server_side=true,     keyfile="server.key",     certfile="server.crt" )  s.send_alert(ssl.alert_description_internal_error) # <--- need 

in example, expect every client receive tls alert internal error after handshake. how can achieve this?


Comments

Popular posts from this blog

javascript - Clear button on addentry page doesn't work -

c# - Selenium Authentication Popup preventing driver close or quit -

tensorflow when input_data MNIST_data , zlib.error: Error -3 while decompressing: invalid block type -