I am attempting to connect a client and server with sslContext.wrap_socket with the Python ssl library. I am getting some strange SSL errors including WRONG_VERSION_NUMBER and UNKNOWN_CA even though both the version number and CA are specifically hardcoded in the server and client. To double check that these hardcoded values are getting through, I want to print out the certificate fields and the TLS version number the client is attempting to connect with. I can do this with SSLSocket.getpeercert() and SSLSocket.version(), but this only works after the handshake (in sslContext.wrap_socket) is complete. The handshakes resulting in errors never complete, and so I cannot use those methods. Is there a way I can get certificate/TLS transaction information from a failed handshake? Continue reading...