PySocksipyChain icon indicating copy to clipboard operation
PySocksipyChain copied to clipboard

Support Python 3.12 by not using ssl.wrap_socket

Open SunilMohanAdapa opened this issue 1 year ago • 0 comments

  • 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:

  1. https://docs.python.org/3.11/library/ssl.html#ssl.wrap_socket

SunilMohanAdapa avatar Aug 16 '24 16:08 SunilMohanAdapa