Skip to content

Commit d680859

Browse files
authored
remove OCSPResponse abc (#11992)
* remove OCSPResponse abc * flake fix
1 parent e8a0d1d commit d680859

File tree

2 files changed

+60
-200
lines changed

2 files changed

+60
-200
lines changed

src/cryptography/hazmat/bindings/_rust/ocsp.pyi

+58-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
33
# for complete details.
44

5+
import datetime
6+
import typing
7+
58
from cryptography import x509
69
from cryptography.hazmat.primitives import hashes, serialization
710
from cryptography.hazmat.primitives.asymmetric.types import PrivateKeyTypes
@@ -20,7 +23,61 @@ class OCSPRequest:
2023
@property
2124
def extensions(self) -> x509.Extensions: ...
2225

23-
class OCSPResponse: ...
26+
class OCSPResponse:
27+
@property
28+
def responses(self) -> typing.Iterator[OCSPSingleResponse]: ...
29+
@property
30+
def response_status(self) -> ocsp.OCSPResponseStatus: ...
31+
@property
32+
def signature_algorithm_oid(self) -> x509.ObjectIdentifier: ...
33+
@property
34+
def signature_hash_algorithm(
35+
self,
36+
) -> hashes.HashAlgorithm | None: ...
37+
@property
38+
def signature(self) -> bytes: ...
39+
@property
40+
def tbs_response_bytes(self) -> bytes: ...
41+
@property
42+
def certificates(self) -> list[x509.Certificate]: ...
43+
@property
44+
def responder_key_hash(self) -> bytes | None: ...
45+
@property
46+
def responder_name(self) -> x509.Name | None: ...
47+
@property
48+
def produced_at(self) -> datetime.datetime: ...
49+
@property
50+
def produced_at_utc(self) -> datetime.datetime: ...
51+
@property
52+
def certificate_status(self) -> ocsp.OCSPCertStatus: ...
53+
@property
54+
def revocation_time(self) -> datetime.datetime | None: ...
55+
@property
56+
def revocation_time_utc(self) -> datetime.datetime | None: ...
57+
@property
58+
def revocation_reason(self) -> x509.ReasonFlags | None: ...
59+
@property
60+
def this_update(self) -> datetime.datetime: ...
61+
@property
62+
def this_update_utc(self) -> datetime.datetime: ...
63+
@property
64+
def next_update(self) -> datetime.datetime | None: ...
65+
@property
66+
def next_update_utc(self) -> datetime.datetime | None: ...
67+
@property
68+
def issuer_key_hash(self) -> bytes: ...
69+
@property
70+
def issuer_name_hash(self) -> bytes: ...
71+
@property
72+
def hash_algorithm(self) -> hashes.HashAlgorithm: ...
73+
@property
74+
def serial_number(self) -> int: ...
75+
@property
76+
def extensions(self) -> x509.Extensions: ...
77+
@property
78+
def single_extensions(self) -> x509.Extensions: ...
79+
def public_bytes(self, encoding: serialization.Encoding) -> bytes: ...
80+
2481
class OCSPSingleResponse: ...
2582

2683
def load_der_ocsp_request(data: bytes) -> ocsp.OCSPRequest: ...

src/cryptography/x509/ocsp.py

+2-199
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
from cryptography import utils, x509
1212
from cryptography.hazmat.bindings._rust import ocsp
13-
from cryptography.hazmat.primitives import hashes, serialization
13+
from cryptography.hazmat.primitives import hashes
1414
from cryptography.hazmat.primitives.asymmetric.types import (
1515
CertificateIssuerPrivateKeyTypes,
1616
)
@@ -220,205 +220,8 @@ def serial_number(self) -> int:
220220
"""
221221

222222

223-
class OCSPResponse(metaclass=abc.ABCMeta):
224-
@property
225-
@abc.abstractmethod
226-
def responses(self) -> typing.Iterator[OCSPSingleResponse]:
227-
"""
228-
An iterator over the individual SINGLERESP structures in the
229-
response
230-
"""
231-
232-
@property
233-
@abc.abstractmethod
234-
def response_status(self) -> OCSPResponseStatus:
235-
"""
236-
The status of the response. This is a value from the OCSPResponseStatus
237-
enumeration
238-
"""
239-
240-
@property
241-
@abc.abstractmethod
242-
def signature_algorithm_oid(self) -> x509.ObjectIdentifier:
243-
"""
244-
The ObjectIdentifier of the signature algorithm
245-
"""
246-
247-
@property
248-
@abc.abstractmethod
249-
def signature_hash_algorithm(
250-
self,
251-
) -> hashes.HashAlgorithm | None:
252-
"""
253-
Returns a HashAlgorithm corresponding to the type of the digest signed
254-
"""
255-
256-
@property
257-
@abc.abstractmethod
258-
def signature(self) -> bytes:
259-
"""
260-
The signature bytes
261-
"""
262-
263-
@property
264-
@abc.abstractmethod
265-
def tbs_response_bytes(self) -> bytes:
266-
"""
267-
The tbsResponseData bytes
268-
"""
269-
270-
@property
271-
@abc.abstractmethod
272-
def certificates(self) -> list[x509.Certificate]:
273-
"""
274-
A list of certificates used to help build a chain to verify the OCSP
275-
response. This situation occurs when the OCSP responder uses a delegate
276-
certificate.
277-
"""
278-
279-
@property
280-
@abc.abstractmethod
281-
def responder_key_hash(self) -> bytes | None:
282-
"""
283-
The responder's key hash or None
284-
"""
285-
286-
@property
287-
@abc.abstractmethod
288-
def responder_name(self) -> x509.Name | None:
289-
"""
290-
The responder's Name or None
291-
"""
292-
293-
@property
294-
@abc.abstractmethod
295-
def produced_at(self) -> datetime.datetime:
296-
"""
297-
The time the response was produced
298-
"""
299-
300-
@property
301-
@abc.abstractmethod
302-
def produced_at_utc(self) -> datetime.datetime:
303-
"""
304-
The time the response was produced. Represented as a non-naive UTC
305-
datetime.
306-
"""
307-
308-
@property
309-
@abc.abstractmethod
310-
def certificate_status(self) -> OCSPCertStatus:
311-
"""
312-
The status of the certificate (an element from the OCSPCertStatus enum)
313-
"""
314-
315-
@property
316-
@abc.abstractmethod
317-
def revocation_time(self) -> datetime.datetime | None:
318-
"""
319-
The date of when the certificate was revoked or None if not
320-
revoked.
321-
"""
322-
323-
@property
324-
@abc.abstractmethod
325-
def revocation_time_utc(self) -> datetime.datetime | None:
326-
"""
327-
The date of when the certificate was revoked or None if not
328-
revoked. Represented as a non-naive UTC datetime.
329-
"""
330-
331-
@property
332-
@abc.abstractmethod
333-
def revocation_reason(self) -> x509.ReasonFlags | None:
334-
"""
335-
The reason the certificate was revoked or None if not specified or
336-
not revoked.
337-
"""
338-
339-
@property
340-
@abc.abstractmethod
341-
def this_update(self) -> datetime.datetime:
342-
"""
343-
The most recent time at which the status being indicated is known by
344-
the responder to have been correct
345-
"""
346-
347-
@property
348-
@abc.abstractmethod
349-
def this_update_utc(self) -> datetime.datetime:
350-
"""
351-
The most recent time at which the status being indicated is known by
352-
the responder to have been correct. Represented as a non-naive UTC
353-
datetime.
354-
"""
355-
356-
@property
357-
@abc.abstractmethod
358-
def next_update(self) -> datetime.datetime | None:
359-
"""
360-
The time when newer information will be available
361-
"""
362-
363-
@property
364-
@abc.abstractmethod
365-
def next_update_utc(self) -> datetime.datetime | None:
366-
"""
367-
The time when newer information will be available. Represented as a
368-
non-naive UTC datetime.
369-
"""
370-
371-
@property
372-
@abc.abstractmethod
373-
def issuer_key_hash(self) -> bytes:
374-
"""
375-
The hash of the issuer public key
376-
"""
377-
378-
@property
379-
@abc.abstractmethod
380-
def issuer_name_hash(self) -> bytes:
381-
"""
382-
The hash of the issuer name
383-
"""
384-
385-
@property
386-
@abc.abstractmethod
387-
def hash_algorithm(self) -> hashes.HashAlgorithm:
388-
"""
389-
The hash algorithm used in the issuer name and key hashes
390-
"""
391-
392-
@property
393-
@abc.abstractmethod
394-
def serial_number(self) -> int:
395-
"""
396-
The serial number of the cert whose status is being checked
397-
"""
398-
399-
@property
400-
@abc.abstractmethod
401-
def extensions(self) -> x509.Extensions:
402-
"""
403-
The list of response extensions. Not single response extensions.
404-
"""
405-
406-
@property
407-
@abc.abstractmethod
408-
def single_extensions(self) -> x509.Extensions:
409-
"""
410-
The list of single response extensions. Not response extensions.
411-
"""
412-
413-
@abc.abstractmethod
414-
def public_bytes(self, encoding: serialization.Encoding) -> bytes:
415-
"""
416-
Serializes the response to DER
417-
"""
418-
419-
420223
OCSPRequest = ocsp.OCSPRequest
421-
OCSPResponse.register(ocsp.OCSPResponse)
224+
OCSPResponse = ocsp.OCSPResponse
422225
OCSPSingleResponse.register(ocsp.OCSPSingleResponse)
423226

424227

0 commit comments

Comments
 (0)