{"id":"c5abbe61137089e8","repo":"redis/redis-py","slug":"no-certificate-found-for-ssl-peer","errorCode":null,"errorMessage":"no certificate found for ssl peer","messagePattern":"no certificate found for ssl peer","errorType":"exception","errorClass":"ConnectionError","httpStatus":null,"severity":"error","filePath":"redis/ocsp.py","lineNumber":199,"sourceCode":"        self.PORT = port\n        self.CA_CERTS = ca_certs\n\n    def _bin2ascii(self, der):\n        \"\"\"Convert SSL certificates in a binary (DER) format to ASCII PEM.\"\"\"\n\n        pem = ssl.DER_cert_to_PEM_cert(der)\n        cert = x509.load_pem_x509_certificate(pem.encode(), backends.default_backend())\n        return cert\n\n    def components_from_socket(self):\n        \"\"\"This function returns the certificate, primary issuer, and primary ocsp\n        server in the chain for a socket already wrapped with ssl.\n        \"\"\"\n\n        # convert the binary certificate to text\n        der = self.SOCK.getpeercert(True)\n        if der is False:\n            raise ConnectionError(\"no certificate found for ssl peer\")\n        cert = self._bin2ascii(der)\n        return self._certificate_components(cert)\n\n    def _certificate_components(self, cert):\n        \"\"\"Given an SSL certificate, retract the useful components for\n        validating the certificate status with an OCSP server.\n\n        Args:\n            cert ([bytes]): A PEM encoded ssl certificate\n        \"\"\"\n\n        try:\n            aia = cert.extensions.get_extension_for_oid(\n                x509.oid.ExtensionOID.AUTHORITY_INFORMATION_ACCESS\n            ).value\n        except cryptography.x509.extensions.ExtensionNotFound:\n            raise ConnectionError(\"No AIA information present in ssl certificate\")\n","sourceCodeStart":181,"sourceCodeEnd":217,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/ocsp.py#L181-L217","documentation":"Error \"no certificate found for ssl peer\" thrown in redis/redis-py.","triggerScenarios":"Thrown at redis/ocsp.py:199 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"analyzedSha":"da03cdc7e8731092b13e395605c3c1fb2de25de1","analyzedAt":"2026-08-04T20:26:47.563Z","schemaVersion":2}