Skip to content

Commit

Permalink
remove OCSPRequest abc (#11990)
Browse files Browse the repository at this point in the history
  • Loading branch information
reaperhulk authored Nov 17, 2024
1 parent 451003b commit e8a0d1d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 46 deletions.
17 changes: 15 additions & 2 deletions src/cryptography/hazmat/bindings/_rust/ocsp.pyi
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,24 @@
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.

from cryptography.hazmat.primitives import hashes
from cryptography import x509
from cryptography.hazmat.primitives import hashes, serialization
from cryptography.hazmat.primitives.asymmetric.types import PrivateKeyTypes
from cryptography.x509 import ocsp

class OCSPRequest: ...
class OCSPRequest:
@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 public_bytes(self, encoding: serialization.Encoding) -> bytes: ...
@property
def extensions(self) -> x509.Extensions: ...

class OCSPResponse: ...
class OCSPSingleResponse: ...

Expand Down
45 changes: 1 addition & 44 deletions src/cryptography/x509/ocsp.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,49 +127,6 @@ def __init__(
self._revocation_reason = revocation_reason


class OCSPRequest(metaclass=abc.ABCMeta):
@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
"""

@abc.abstractmethod
def public_bytes(self, encoding: serialization.Encoding) -> bytes:
"""
Serializes the request to DER
"""

@property
@abc.abstractmethod
def extensions(self) -> x509.Extensions:
"""
The list of request extensions. Not single request extensions.
"""


class OCSPSingleResponse(metaclass=abc.ABCMeta):
@property
@abc.abstractmethod
Expand Down Expand Up @@ -460,7 +417,7 @@ def public_bytes(self, encoding: serialization.Encoding) -> bytes:
"""


OCSPRequest.register(ocsp.OCSPRequest)
OCSPRequest = ocsp.OCSPRequest
OCSPResponse.register(ocsp.OCSPResponse)
OCSPSingleResponse.register(ocsp.OCSPSingleResponse)

Expand Down

0 comments on commit e8a0d1d

Please sign in to comment.