{"id":"179b2e6516bd02de","repo":"redis/redis-py","slug":"no-ocsp-response-present","errorCode":null,"errorMessage":"no ocsp response present","messagePattern":"no ocsp response present","errorType":"exception","errorClass":"ConnectionError","httpStatus":null,"severity":"error","filePath":"redis/ocsp.py","lineNumber":149,"sourceCode":"        h = pubkey.public_bytes(Encoding.DER, PublicFormat.PKCS1)\n    elif isinstance(pubkey, EllipticCurvePublicKey):\n        h = pubkey.public_bytes(Encoding.X962, PublicFormat.UncompressedPoint)\n    else:\n        h = pubkey.public_bytes(Encoding.DER, PublicFormat.SubjectPublicKeyInfo)\n\n    sha1 = Hash(SHA1(), backend=backends.default_backend())\n    sha1.update(h)\n    return sha1.finalize()\n\n\ndef ocsp_staple_verifier(con, ocsp_bytes, expected=None):\n    \"\"\"An implementation of a function for set_ocsp_client_callback in PyOpenSSL.\n\n    This function validates that the provide ocsp_bytes response is valid,\n    and matches the expected, stapled responses.\n    \"\"\"\n    if ocsp_bytes in [b\"\", None]:\n        raise ConnectionError(\"no ocsp response present\")\n\n    issuer_cert = None\n    peer_cert = con.get_peer_certificate().to_cryptography()\n    for c in con.get_peer_cert_chain():\n        cert = c.to_cryptography()\n        if cert.subject == peer_cert.issuer:\n            issuer_cert = cert\n            break\n\n    if issuer_cert is None:\n        raise ConnectionError(\"no matching issuer cert found in certificate chain\")\n\n    if expected is not None:\n        e = x509.load_pem_x509_certificate(expected)\n        if peer_cert != e:\n            raise ConnectionError(\"received and expected certificates do not match\")\n\n    return _check_certificate(issuer_cert, ocsp_bytes)","sourceCodeStart":131,"sourceCodeEnd":167,"githubUrl":"https://github.com/redis/redis-py/blob/da03cdc7e8731092b13e395605c3c1fb2de25de1/redis/ocsp.py#L131-L167","documentation":"Error \"no ocsp response present\" thrown in redis/redis-py.","triggerScenarios":"Thrown at redis/ocsp.py:149 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}