For me, this error message was caused by using ssl.Purpose.CLIENT_AUTH instead of ssl.Purpose.SERVER_AUTH in my ssl.create_default_context() arguments. Clients should use ssl.Purpose.SERVER_AUTH because they are authorizing the servers they are communicating with, not ssl.Purpose.CLIENT_AUTH, and vice versa for servers.
import socket
import ssl
ME_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sslContext = ssl.create_default_context(purpose = ssl.Purpose.SERVER_AUTH, cafile = 'C://...//CACert.pem', capath = None, cadata = None)
sslContext.load_cert_chain(certfile = 'C://...//serverCert.pem')
ME_SSL = sslContext.wrap_socket(ME_socket, server_side = False, server_hostname = 'MY_IP')
Answer from mwolfe 11 on Stack OverflowFor me, this error message was caused by using ssl.Purpose.CLIENT_AUTH instead of ssl.Purpose.SERVER_AUTH in my ssl.create_default_context() arguments. Clients should use ssl.Purpose.SERVER_AUTH because they are authorizing the servers they are communicating with, not ssl.Purpose.CLIENT_AUTH, and vice versa for servers.
import socket
import ssl
ME_socket = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
sslContext = ssl.create_default_context(purpose = ssl.Purpose.SERVER_AUTH, cafile = 'C://...//CACert.pem', capath = None, cadata = None)
sslContext.load_cert_chain(certfile = 'C://...//serverCert.pem')
ME_SSL = sslContext.wrap_socket(ME_socket, server_side = False, server_hostname = 'MY_IP')
This is a known issue in the ssl library and there are MANY GitHub issues based on this. For example, this one is a sample issue. For me, it worked by using ssl._create_default_https_context = ssl._create_unverified_context in previous projects. Idk if it will work for Roblox because I don't have access to it.