Skip to content

Commit 6311b9d

Browse files
authored
remove crl abc (#11991)
* remove crl abc * flake fix * oops
1 parent d680859 commit 6311b9d

File tree

2 files changed

+46
-150
lines changed

2 files changed

+46
-150
lines changed

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

+45-1
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ from cryptography.hazmat.primitives import hashes, serialization
1010
from cryptography.hazmat.primitives.asymmetric.ec import ECDSA
1111
from cryptography.hazmat.primitives.asymmetric.padding import PSS, PKCS1v15
1212
from cryptography.hazmat.primitives.asymmetric.types import (
13+
CertificateIssuerPublicKeyTypes,
1314
CertificatePublicKeyTypes,
1415
PrivateKeyTypes,
1516
)
@@ -103,7 +104,50 @@ class Certificate:
103104
def verify_directly_issued_by(self, issuer: Certificate) -> None: ...
104105

105106
class RevokedCertificate: ...
106-
class CertificateRevocationList: ...
107+
108+
class CertificateRevocationList:
109+
def public_bytes(self, encoding: serialization.Encoding) -> bytes: ...
110+
def fingerprint(self, algorithm: hashes.HashAlgorithm) -> bytes: ...
111+
def get_revoked_certificate_by_serial_number(
112+
self, serial_number: int
113+
) -> RevokedCertificate | None: ...
114+
@property
115+
def signature_hash_algorithm(
116+
self,
117+
) -> hashes.HashAlgorithm | None: ...
118+
@property
119+
def signature_algorithm_oid(self) -> x509.ObjectIdentifier: ...
120+
@property
121+
def signature_algorithm_parameters(
122+
self,
123+
) -> None | PSS | PKCS1v15 | ECDSA: ...
124+
@property
125+
def issuer(self) -> x509.Name: ...
126+
@property
127+
def next_update(self) -> datetime.datetime | None: ...
128+
@property
129+
def next_update_utc(self) -> datetime.datetime | None: ...
130+
@property
131+
def last_update(self) -> datetime.datetime: ...
132+
@property
133+
def last_update_utc(self) -> datetime.datetime: ...
134+
@property
135+
def extensions(self) -> x509.Extensions: ...
136+
@property
137+
def signature(self) -> bytes: ...
138+
@property
139+
def tbs_certlist_bytes(self) -> bytes: ...
140+
def __eq__(self, other: object) -> bool: ...
141+
def __len__(self) -> int: ...
142+
@typing.overload
143+
def __getitem__(self, idx: int) -> x509.RevokedCertificate: ...
144+
@typing.overload
145+
def __getitem__(self, idx: slice) -> list[x509.RevokedCertificate]: ...
146+
def __iter__(self) -> typing.Iterator[x509.RevokedCertificate]: ...
147+
def is_signature_valid(
148+
self, public_key: CertificateIssuerPublicKeyTypes
149+
) -> bool: ...
150+
107151
class CertificateSigningRequest: ...
108152

109153
class PolicyBuilder:

src/cryptography/x509/base.py

+1-149
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,6 @@
2525
)
2626
from cryptography.hazmat.primitives.asymmetric.types import (
2727
CertificateIssuerPrivateKeyTypes,
28-
CertificateIssuerPublicKeyTypes,
2928
CertificatePublicKeyTypes,
3029
)
3130
from cryptography.x509.extensions import (
@@ -232,154 +231,7 @@ def extensions(self) -> Extensions:
232231
return self._extensions
233232

234233

235-
class CertificateRevocationList(metaclass=abc.ABCMeta):
236-
@abc.abstractmethod
237-
def public_bytes(self, encoding: serialization.Encoding) -> bytes:
238-
"""
239-
Serializes the CRL to PEM or DER format.
240-
"""
241-
242-
@abc.abstractmethod
243-
def fingerprint(self, algorithm: hashes.HashAlgorithm) -> bytes:
244-
"""
245-
Returns bytes using digest passed.
246-
"""
247-
248-
@abc.abstractmethod
249-
def get_revoked_certificate_by_serial_number(
250-
self, serial_number: int
251-
) -> RevokedCertificate | None:
252-
"""
253-
Returns an instance of RevokedCertificate or None if the serial_number
254-
is not in the CRL.
255-
"""
256-
257-
@property
258-
@abc.abstractmethod
259-
def signature_hash_algorithm(
260-
self,
261-
) -> hashes.HashAlgorithm | None:
262-
"""
263-
Returns a HashAlgorithm corresponding to the type of the digest signed
264-
in the certificate.
265-
"""
266-
267-
@property
268-
@abc.abstractmethod
269-
def signature_algorithm_oid(self) -> ObjectIdentifier:
270-
"""
271-
Returns the ObjectIdentifier of the signature algorithm.
272-
"""
273-
274-
@property
275-
@abc.abstractmethod
276-
def signature_algorithm_parameters(
277-
self,
278-
) -> None | padding.PSS | padding.PKCS1v15 | ec.ECDSA:
279-
"""
280-
Returns the signature algorithm parameters.
281-
"""
282-
283-
@property
284-
@abc.abstractmethod
285-
def issuer(self) -> Name:
286-
"""
287-
Returns the X509Name with the issuer of this CRL.
288-
"""
289-
290-
@property
291-
@abc.abstractmethod
292-
def next_update(self) -> datetime.datetime | None:
293-
"""
294-
Returns the date of next update for this CRL.
295-
"""
296-
297-
@property
298-
@abc.abstractmethod
299-
def next_update_utc(self) -> datetime.datetime | None:
300-
"""
301-
Returns the date of next update for this CRL as a non-naive UTC
302-
datetime.
303-
"""
304-
305-
@property
306-
@abc.abstractmethod
307-
def last_update(self) -> datetime.datetime:
308-
"""
309-
Returns the date of last update for this CRL.
310-
"""
311-
312-
@property
313-
@abc.abstractmethod
314-
def last_update_utc(self) -> datetime.datetime:
315-
"""
316-
Returns the date of last update for this CRL as a non-naive UTC
317-
datetime.
318-
"""
319-
320-
@property
321-
@abc.abstractmethod
322-
def extensions(self) -> Extensions:
323-
"""
324-
Returns an Extensions object containing a list of CRL extensions.
325-
"""
326-
327-
@property
328-
@abc.abstractmethod
329-
def signature(self) -> bytes:
330-
"""
331-
Returns the signature bytes.
332-
"""
333-
334-
@property
335-
@abc.abstractmethod
336-
def tbs_certlist_bytes(self) -> bytes:
337-
"""
338-
Returns the tbsCertList payload bytes as defined in RFC 5280.
339-
"""
340-
341-
@abc.abstractmethod
342-
def __eq__(self, other: object) -> bool:
343-
"""
344-
Checks equality.
345-
"""
346-
347-
@abc.abstractmethod
348-
def __len__(self) -> int:
349-
"""
350-
Number of revoked certificates in the CRL.
351-
"""
352-
353-
@typing.overload
354-
def __getitem__(self, idx: int) -> RevokedCertificate: ...
355-
356-
@typing.overload
357-
def __getitem__(self, idx: slice) -> list[RevokedCertificate]: ...
358-
359-
@abc.abstractmethod
360-
def __getitem__(
361-
self, idx: int | slice
362-
) -> RevokedCertificate | list[RevokedCertificate]:
363-
"""
364-
Returns a revoked certificate (or slice of revoked certificates).
365-
"""
366-
367-
@abc.abstractmethod
368-
def __iter__(self) -> typing.Iterator[RevokedCertificate]:
369-
"""
370-
Iterator over the revoked certificates
371-
"""
372-
373-
@abc.abstractmethod
374-
def is_signature_valid(
375-
self, public_key: CertificateIssuerPublicKeyTypes
376-
) -> bool:
377-
"""
378-
Verifies signature of revocation list against given public key.
379-
"""
380-
381-
382-
CertificateRevocationList.register(rust_x509.CertificateRevocationList)
234+
CertificateRevocationList = rust_x509.CertificateRevocationList
383235

384236

385237
class CertificateSigningRequest(metaclass=abc.ABCMeta):

0 commit comments

Comments
 (0)