Skip to content

Commit 3fdf1f8

Browse files
authored
remove csr abc (#11994)
1 parent 1cae81e commit 3fdf1f8

File tree

2 files changed

+30
-107
lines changed

2 files changed

+30
-107
lines changed

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

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,34 @@ class CertificateRevocationList:
148148
self, public_key: CertificateIssuerPublicKeyTypes
149149
) -> bool: ...
150150

151-
class CertificateSigningRequest: ...
151+
class CertificateSigningRequest:
152+
def __eq__(self, other: object) -> bool: ...
153+
def __hash__(self) -> int: ...
154+
def public_key(self) -> CertificatePublicKeyTypes: ...
155+
@property
156+
def subject(self) -> x509.Name: ...
157+
@property
158+
def signature_hash_algorithm(
159+
self,
160+
) -> hashes.HashAlgorithm | None: ...
161+
@property
162+
def signature_algorithm_oid(self) -> x509.ObjectIdentifier: ...
163+
@property
164+
def signature_algorithm_parameters(
165+
self,
166+
) -> None | PSS | PKCS1v15 | ECDSA: ...
167+
@property
168+
def extensions(self) -> x509.Extensions: ...
169+
@property
170+
def attributes(self) -> x509.Attributes: ...
171+
def public_bytes(self, encoding: serialization.Encoding) -> bytes: ...
172+
@property
173+
def signature(self) -> bytes: ...
174+
@property
175+
def tbs_certrequest_bytes(self) -> bytes: ...
176+
@property
177+
def is_signature_valid(self) -> bool: ...
178+
def get_attribute_for_oid(self, oid: x509.ObjectIdentifier) -> bytes: ...
152179

153180
class PolicyBuilder:
154181
def time(self, new_time: datetime.datetime) -> PolicyBuilder: ...

src/cryptography/x509/base.py

Lines changed: 2 additions & 106 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from cryptography import utils
1414
from cryptography.hazmat.bindings._rust import x509 as rust_x509
15-
from cryptography.hazmat.primitives import hashes, serialization
15+
from cryptography.hazmat.primitives import hashes
1616
from cryptography.hazmat.primitives.asymmetric import (
1717
dsa,
1818
ec,
@@ -232,111 +232,7 @@ def extensions(self) -> Extensions:
232232

233233

234234
CertificateRevocationList = rust_x509.CertificateRevocationList
235-
236-
237-
class CertificateSigningRequest(metaclass=abc.ABCMeta):
238-
@abc.abstractmethod
239-
def __eq__(self, other: object) -> bool:
240-
"""
241-
Checks equality.
242-
"""
243-
244-
@abc.abstractmethod
245-
def __hash__(self) -> int:
246-
"""
247-
Computes a hash.
248-
"""
249-
250-
@abc.abstractmethod
251-
def public_key(self) -> CertificatePublicKeyTypes:
252-
"""
253-
Returns the public key
254-
"""
255-
256-
@property
257-
@abc.abstractmethod
258-
def subject(self) -> Name:
259-
"""
260-
Returns the subject name object.
261-
"""
262-
263-
@property
264-
@abc.abstractmethod
265-
def signature_hash_algorithm(
266-
self,
267-
) -> hashes.HashAlgorithm | None:
268-
"""
269-
Returns a HashAlgorithm corresponding to the type of the digest signed
270-
in the certificate.
271-
"""
272-
273-
@property
274-
@abc.abstractmethod
275-
def signature_algorithm_oid(self) -> ObjectIdentifier:
276-
"""
277-
Returns the ObjectIdentifier of the signature algorithm.
278-
"""
279-
280-
@property
281-
@abc.abstractmethod
282-
def signature_algorithm_parameters(
283-
self,
284-
) -> None | padding.PSS | padding.PKCS1v15 | ec.ECDSA:
285-
"""
286-
Returns the signature algorithm parameters.
287-
"""
288-
289-
@property
290-
@abc.abstractmethod
291-
def extensions(self) -> Extensions:
292-
"""
293-
Returns the extensions in the signing request.
294-
"""
295-
296-
@property
297-
@abc.abstractmethod
298-
def attributes(self) -> Attributes:
299-
"""
300-
Returns an Attributes object.
301-
"""
302-
303-
@abc.abstractmethod
304-
def public_bytes(self, encoding: serialization.Encoding) -> bytes:
305-
"""
306-
Encodes the request to PEM or DER format.
307-
"""
308-
309-
@property
310-
@abc.abstractmethod
311-
def signature(self) -> bytes:
312-
"""
313-
Returns the signature bytes.
314-
"""
315-
316-
@property
317-
@abc.abstractmethod
318-
def tbs_certrequest_bytes(self) -> bytes:
319-
"""
320-
Returns the PKCS#10 CertificationRequestInfo bytes as defined in RFC
321-
2986.
322-
"""
323-
324-
@property
325-
@abc.abstractmethod
326-
def is_signature_valid(self) -> bool:
327-
"""
328-
Verifies signature of signing request.
329-
"""
330-
331-
@abc.abstractmethod
332-
def get_attribute_for_oid(self, oid: ObjectIdentifier) -> bytes:
333-
"""
334-
Get the attribute value for a given OID.
335-
"""
336-
337-
338-
# Runtime isinstance checks need this since the rust class is not a subclass.
339-
CertificateSigningRequest.register(rust_x509.CertificateSigningRequest)
235+
CertificateSigningRequest = rust_x509.CertificateSigningRequest
340236

341237

342238
load_pem_x509_certificate = rust_x509.load_pem_x509_certificate

0 commit comments

Comments
 (0)