aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Gaynor <alex.gaynor@gmail.com>2024-06-03 09:32:28 -0400
committerGitHub <noreply@github.com>2024-06-03 06:32:28 -0700
commitd54d67353b5384bee303024cbc55b1392a87ee6d (patch)
tree0b4f6116cf582d05d7326e721d3b140f43e2dbb0
parent0419242d00a1ffbbf7ea0ee0135a9a3e60ef2298 (diff)
downloadpyca-cryptography-d54d67353b5384bee303024cbc55b1392a87ee6d.zip
pyca-cryptography-d54d67353b5384bee303024cbc55b1392a87ee6d.tar.gz
pyca-cryptography-d54d67353b5384bee303024cbc55b1392a87ee6d.tar.bz2
Register OCSPSingleResponse implementation with interface (#11066)
-rw-r--r--src/cryptography/hazmat/bindings/_rust/ocsp.pyi1
-rw-r--r--src/cryptography/x509/ocsp.py1
-rw-r--r--src/rust/src/x509/ocsp_resp.rs1
-rw-r--r--tests/x509/test_ocsp.py1
4 files changed, 4 insertions, 0 deletions
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::<OCSPResponse>()?;
+ module.add_class::<OCSPSingleResponse>()?;
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):