PySocksipyChain
PySocksipyChain copied to clipboard
Support Python 3.12 by not using ssl.wrap_socket
-
ssl.wrap_socket() has been deprecated since Python 3.7[1]. In Python 3.12, the function has been removed and causes hard failure.
-
Recommended way to replace ssl.wrap_socket() is to use SSLContext.wrap_socket(). To get the exact earlier behavior:
-
CA certificates are loading using SSLContext.load_verify_locations().
-
Certificate for our peer is loaded using SSLContext.load_cert_chain().
-
Ciphers are set using SSLContext.set_ciphers().
-
cert_reqs is replaced with context.verify_mode.
-
SSLContext.check_hostname has not been set to true because there is a custom implementation checking hostnames.
-
Links:
- https://docs.python.org/3.11/library/ssl.html#ssl.wrap_socket