diff --git a/src/cryptography/hazmat/bindings/_rust/ocsp.pyi b/src/cryptography/hazmat/bindings/_rust/ocsp.pyi index bd80ba3fe7a3..e4321bec2ad2 100644 --- a/src/cryptography/hazmat/bindings/_rust/ocsp.pyi +++ b/src/cryptography/hazmat/bindings/_rust/ocsp.pyi @@ -78,7 +78,31 @@ class OCSPResponse: def single_extensions(self) -> x509.Extensions: ... def public_bytes(self, encoding: serialization.Encoding) -> bytes: ... -class OCSPSingleResponse: ... +class OCSPSingleResponse: + @property + def certificate_status(self) -> ocsp.OCSPCertStatus: ... + @property + def revocation_time(self) -> datetime.datetime | None: ... + @property + def revocation_time_utc(self) -> datetime.datetime | None: ... + @property + def revocation_reason(self) -> x509.ReasonFlags | None: ... + @property + def this_update(self) -> datetime.datetime: ... + @property + def this_update_utc(self) -> datetime.datetime: ... + @property + def next_update(self) -> datetime.datetime | None: ... + @property + def next_update_utc(self) -> datetime.datetime | None: ... + @property + def issuer_key_hash(self) -> bytes: ... + @property + def issuer_name_hash(self) -> bytes: ... + @property + def hash_algorithm(self) -> hashes.HashAlgorithm: ... + @property + def serial_number(self) -> int: ... 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 27091e68c229..5a011c412ad3 100644 --- a/src/cryptography/x509/ocsp.py +++ b/src/cryptography/x509/ocsp.py @@ -4,7 +4,6 @@ from __future__ import annotations -import abc import datetime import typing @@ -127,102 +126,9 @@ def __init__( self._revocation_reason = revocation_reason -class OCSPSingleResponse(metaclass=abc.ABCMeta): - @property - @abc.abstractmethod - def certificate_status(self) -> OCSPCertStatus: - """ - The status of the certificate (an element from the OCSPCertStatus enum) - """ - - @property - @abc.abstractmethod - def revocation_time(self) -> datetime.datetime | None: - """ - The date of when the certificate was revoked or None if not - revoked. - """ - - @property - @abc.abstractmethod - def revocation_time_utc(self) -> datetime.datetime | None: - """ - The date of when the certificate was revoked or None if not - revoked. Represented as a non-naive UTC datetime. - """ - - @property - @abc.abstractmethod - def revocation_reason(self) -> x509.ReasonFlags | None: - """ - The reason the certificate was revoked or None if not specified or - not revoked. - """ - - @property - @abc.abstractmethod - def this_update(self) -> datetime.datetime: - """ - The most recent time at which the status being indicated is known by - the responder to have been correct - """ - - @property - @abc.abstractmethod - def this_update_utc(self) -> datetime.datetime: - """ - The most recent time at which the status being indicated is known by - the responder to have been correct. Represented as a non-naive UTC - datetime. - """ - - @property - @abc.abstractmethod - def next_update(self) -> datetime.datetime | None: - """ - The time when newer information will be available - """ - - @property - @abc.abstractmethod - def next_update_utc(self) -> datetime.datetime | None: - """ - The time when newer information will be available. Represented as a - non-naive UTC datetime. - """ - - @property - @abc.abstractmethod - def issuer_key_hash(self) -> bytes: - """ - The hash of the issuer public key - """ - - @property - @abc.abstractmethod - def issuer_name_hash(self) -> bytes: - """ - The hash of the issuer name - """ - - @property - @abc.abstractmethod - def hash_algorithm(self) -> hashes.HashAlgorithm: - """ - The hash algorithm used in the issuer name and key hashes - """ - - @property - @abc.abstractmethod - def serial_number(self) -> int: - """ - The serial number of the cert whose status is being checked - """ - - OCSPRequest = ocsp.OCSPRequest OCSPResponse = ocsp.OCSPResponse -OCSPSingleResponse.register(ocsp.OCSPSingleResponse) +OCSPSingleResponse = ocsp.OCSPSingleResponse class OCSPRequestBuilder: