smart_meter_texas/__init__.py
def create_ssl_context(self, certificate: bin = None):
        """Creates the SSL Context using the CA Issuers binary data"""
        ssl_context = ssl.create_default_context(capath=certifi.where())
        try:
            if certificate:
                ssl_context.load_verify_locations(
                    cafile=certifi.where(), cadata=certificate
                )
                _LOGGER.debug("Loaded certificate file into SSL Context")
        except Exception as error:
            _LOGGER.error("Error loading certificate file into SSL Context")
            ssl_context = ssl.create_default_context(capath=certifi.where())

        # Enable strict checking
        ssl_context.check_hostname = True
        ssl_context.verify_mode = ssl.CERT_REQUIRED
        # Disable SSL, TLSv1, TLSv1.1
        ssl_context.options |= (
            ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1 | ssl.OP_NO_SSLv3 | ssl.OP_NO_SSLv2
        )

        return ssl_context
Creates the SSL Context using the CA Issuers binary data
Creates the SSL Context using the CA Issuers binary data
Creates the SSL Context using the CA Issuers binary data
def create_ssl_context(self, certificate: bin = None):
        ssl_context = ssl.create_default_context(capath=certifi.where())
        try:
            if certificate:
                ssl_context.load_verify_locations(
                    cafile=certifi.where(), cadata=certificate
                )
                _LOGGER.debug("Loaded certificate file into SSL Context")
        except Exception as error:
            _LOGGER.error("Error loading certificate file into SSL Context")
            ssl_context = ssl.create_default_context(capath=certifi.where())
        ssl_context.check_hostname = True
        ssl_context.verify_mode = ssl.CERT_REQUIRED
        ssl_context.options |= (
            ssl.OP_NO_TLSv1 | ssl.OP_NO_TLSv1_1 | ssl.OP_NO_SSLv3 | ssl.OP_NO_SSLv2
        )
        return ssl_context
def create_ssl_context ( self , certificate : bin = None ) : ssl_context = ssl . create_default_context ( capath = certifi . where ( ) ) try : if certificate : ssl_context . load_verify_locations ( cafile = certifi . where ( ) , cadata = certificate ) _LOGGER . debug ( "Loaded certificate file into SSL Context" ) except Exception as error : _LOGGER . error ( "Error loading certificate file into SSL Context" ) ssl_context = ssl . create_default_context ( capath = certifi . where ( ) ) ssl_context . check_hostname = True ssl_context . verify_mode = ssl . CERT_REQUIRED ssl_context . options |= ( ssl . OP_NO_TLSv1 | ssl . OP_NO_TLSv1_1 | ssl . OP_NO_SSLv3 | ssl . OP_NO_SSLv2 ) return ssl_context
Creates the SSL Context using the CA Issuers binary data
Creates the SSL Context using the CA Issuers binary data
"""Creates the SSL Context using the CA Issuers binary data""" # Enable strict checking # Disable SSL, TLSv1, TLSv1.1
self
certificate
bin