From d54d67353b5384bee303024cbc55b1392a87ee6d Mon Sep 17 00:00:00 2001 From: Alex Gaynor Date: Mon, 3 Jun 2024 09:32:28 -0400 Subject: Register OCSPSingleResponse implementation with interface (#11066) --- src/cryptography/hazmat/bindings/_rust/ocsp.pyi | 1 + src/cryptography/x509/ocsp.py | 1 + src/rust/src/x509/ocsp_resp.rs | 1 + tests/x509/test_ocsp.py | 1 + 4 files changed, 4 insertions(+) diff --git a/src/cryptography/hazmat/bindings/_rust/ocsp.pyi b/src/cryptography/hazmat/bindings/_rust/ocsp.pyi index 29c4372..5e02145 100644 --- a/src/cryptography/hazmat/bindings/_rust/ocsp.pyi +++ b/src/cryptography/hazmat/bindings/_rust/ocsp.pyi @@ -8,6 +8,7 @@ from cryptography.x509 import ocsp class OCSPRequest: ... class OCSPResponse: ... +class OCSPSingleResponse: ... def load_der_ocsp_request(data: bytes) -> ocsp.OCSPRequest: ... def load_der_ocsp_response(data: bytes) -> ocsp.OCSPResponse: ... diff --git a/src/cryptography/x509/ocsp.py b/src/cryptography/x509/ocsp.py index ec2f2da..9b2adc8 100644 --- a/src/cryptography/x509/ocsp.py +++ b/src/cryptography/x509/ocsp.py @@ -404,6 +404,7 @@ class OCSPResponse(metaclass=abc.ABCMeta): OCSPRequest.register(ocsp.OCSPRequest) OCSPResponse.register(ocsp.OCSPResponse) +OCSPSingleResponse.register(ocsp.OCSPSingleResponse) class OCSPRequestBuilder: diff --git a/src/rust/src/x509/ocsp_resp.rs b/src/rust/src/x509/ocsp_resp.rs index 99cbe58..3233d0b 100644 --- a/src/rust/src/x509/ocsp_resp.rs +++ b/src/rust/src/x509/ocsp_resp.rs @@ -918,6 +918,7 @@ pub(crate) fn add_to_module( module.add_function(pyo3::wrap_pyfunction_bound!(create_ocsp_response, module)?)?; module.add_class::()?; + module.add_class::()?; Ok(()) } diff --git a/tests/x509/test_ocsp.py b/tests/x509/test_ocsp.py index 31e04f6..1d155bb 100644 --- a/tests/x509/test_ocsp.py +++ b/tests/x509/test_ocsp.py @@ -1179,6 +1179,7 @@ class TestOCSPResponse: with pytest.raises(ValueError): resp.serial_number + assert isinstance(next(resp.responses), ocsp.OCSPSingleResponse) assert len(list(resp.responses)) == 20 def test_multi_valued_responses(self): -- cgit v1.1