diff --git a/src/cryptography/hazmat/bindings/_rust/x509.pyi b/src/cryptography/hazmat/bindings/_rust/x509.pyi index 3e950cb42306..196a3c60f7ed 100644 --- a/src/cryptography/hazmat/bindings/_rust/x509.pyi +++ b/src/cryptography/hazmat/bindings/_rust/x509.pyi @@ -129,7 +129,15 @@ class Certificate: def public_bytes(self, encoding: serialization.Encoding) -> bytes: ... def verify_directly_issued_by(self, issuer: Certificate) -> None: ... -class RevokedCertificate: ... +class RevokedCertificate: + @property + def serial_number(self) -> int: ... + @property + def revocation_date(self) -> datetime.datetime: ... + @property + def revocation_date_utc(self) -> datetime.datetime: ... + @property + def extensions(self) -> x509.Extensions: ... class CertificateRevocationList: def public_bytes(self, encoding: serialization.Encoding) -> bytes: ... diff --git a/src/cryptography/x509/base.py b/src/cryptography/x509/base.py index 0134c74680af..a11b8fe02b73 100644 --- a/src/cryptography/x509/base.py +++ b/src/cryptography/x509/base.py @@ -4,7 +4,6 @@ from __future__ import annotations -import abc import datetime import os import typing @@ -29,7 +28,6 @@ ) from cryptography.x509.extensions import ( Extension, - Extensions, ExtensionType, _make_sequence_methods, ) @@ -160,41 +158,7 @@ def __init__(self, msg: str, parsed_version: int) -> None: Certificate = rust_x509.Certificate - - -class RevokedCertificate(metaclass=abc.ABCMeta): - @property - @abc.abstractmethod - def serial_number(self) -> int: - """ - Returns the serial number of the revoked certificate. - """ - - @property - @abc.abstractmethod - def revocation_date(self) -> datetime.datetime: - """ - Returns the date of when this certificate was revoked. - """ - - @property - @abc.abstractmethod - def revocation_date_utc(self) -> datetime.datetime: - """ - Returns the date of when this certificate was revoked as a non-naive - UTC datetime. - """ - - @property - @abc.abstractmethod - def extensions(self) -> Extensions: - """ - Returns an Extensions object containing a list of Revoked extensions. - """ - - -# Runtime isinstance checks need this since the rust class is not a subclass. -RevokedCertificate.register(rust_x509.RevokedCertificate) +RevokedCertificate = rust_x509.RevokedCertificate CertificateRevocationList = rust_x509.CertificateRevocationList