Skip to content

Commit

Permalink
remove OCSPSingleResponse abc (#11993)
Browse files Browse the repository at this point in the history
  • Loading branch information
reaperhulk authored Nov 17, 2024
1 parent 6311b9d commit 1cae81e
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 96 deletions.
26 changes: 25 additions & 1 deletion src/cryptography/hazmat/bindings/_rust/ocsp.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -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: ...
Expand Down
96 changes: 1 addition & 95 deletions src/cryptography/x509/ocsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

from __future__ import annotations

import abc
import datetime
import typing

Expand Down Expand Up @@ -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:
Expand Down

0 comments on commit 1cae81e

Please sign in to comment.