Skip to content

Commit a6678a9

Browse files
authored
make deprecation warnings more prominent in docs (#1379)
1 parent 0baa319 commit a6678a9

File tree

2 files changed

+33
-1
lines changed

2 files changed

+33
-1
lines changed

doc/api/crypto.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,9 @@
66
.. py:module:: OpenSSL.crypto
77
:synopsis: Generic cryptographic module
88

9-
.. note::
9+
.. danger::
10+
11+
**This module is pending deprecation, use pyca/cryptography instead.**
1012

1113
`pyca/cryptography`_ is likely a better choice than using this module.
1214
It contains a complete set of cryptographic primitives as well as a significantly better and more powerful X509 API.

src/OpenSSL/crypto.py

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -800,6 +800,9 @@ def get_components(self) -> list[tuple[bytes, bytes]]:
800800
class X509Extension:
801801
"""
802802
An X.509 v3 certificate extension.
803+
804+
.. deprecated:: 23.3.0
805+
Use cryptography's X509 APIs instead.
803806
"""
804807

805808
def __init__(
@@ -980,6 +983,9 @@ def get_data(self) -> bytes:
980983
class X509Req:
981984
"""
982985
An X.509 certificate signing requests.
986+
987+
.. deprecated:: 24.2.0
988+
Use `cryptography.x509.CertificateSigningRequest` instead.
983989
"""
984990

985991
def __init__(self) -> None:
@@ -2248,6 +2254,9 @@ def dump_privatekey(
22482254
class Revoked:
22492255
"""
22502256
A certificate revocation.
2257+
2258+
.. deprecated:: 23.3.0
2259+
Use cryptography's X509 APIs instead.
22512260
"""
22522261

22532262
# https://www.openssl.org/docs/manmaster/man5/x509v3_config.html#CRL-distribution-points
@@ -2438,6 +2447,9 @@ def get_rev_date(self) -> bytes | None:
24382447
class CRL:
24392448
"""
24402449
A certificate revocation list.
2450+
2451+
.. deprecated:: 23.3.0
2452+
Use cryptography's X509 APIs instead.
24412453
"""
24422454

24432455
def __init__(self) -> None:
@@ -2841,6 +2853,10 @@ def dump_certificate_request(type: int, req: X509Req) -> bytes:
28412853
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
28422854
:param req: The certificate request to dump
28432855
:return: The buffer with the dumped certificate request in
2856+
2857+
2858+
.. deprecated:: 24.2.0
2859+
Use `cryptography.x509.CertificateSigningRequest` instead.
28442860
"""
28452861
bio = _new_mem_buf()
28462862

@@ -2883,6 +2899,10 @@ def load_certificate_request(type: int, buffer: bytes) -> X509Req:
28832899
:param type: The file type (one of FILETYPE_PEM, FILETYPE_ASN1)
28842900
:param buffer: The buffer the certificate request is stored in
28852901
:return: The X509Req object
2902+
2903+
.. deprecated:: 24.2.0
2904+
Use `cryptography.x509.load_der_x509_csr` or
2905+
`cryptography.x509.load_pem_x509_csr` instead.
28862906
"""
28872907
if isinstance(buffer, str):
28882908
buffer = buffer.encode("ascii")
@@ -2927,6 +2947,8 @@ def sign(pkey: PKey, data: str | bytes, digest: str) -> bytes:
29272947
:return: signature
29282948
29292949
.. versionadded:: 0.11
2950+
.. deprecated:: 23.3.0
2951+
Use cryptography's X509 APIs instead.
29302952
"""
29312953
data = _text_to_bytes_and_warn("data", data)
29322954

@@ -2975,6 +2997,8 @@ def verify(
29752997
:return: ``None`` if the signature is correct, raise exception otherwise.
29762998
29772999
.. versionadded:: 0.11
3000+
.. deprecated:: 23.3.0
3001+
Use cryptography's X509 APIs instead.
29783002
"""
29793003
data = _text_to_bytes_and_warn("data", data)
29803004

@@ -3018,6 +3042,9 @@ def dump_crl(type: int, crl: _CRLInternal) -> bytes:
30183042
30193043
:return: The buffer with the CRL.
30203044
:rtype: bytes
3045+
3046+
.. deprecated:: 23.3.0
3047+
Use cryptography's X509 APIs instead.
30213048
"""
30223049
bio = _new_mem_buf()
30233050

@@ -3059,6 +3086,9 @@ def load_crl(type: int, buffer: str | bytes) -> _CRLInternal:
30593086
:param buffer: The buffer the CRL is stored in
30603087
30613088
:return: The CRL object
3089+
3090+
.. deprecated:: 23.3.0
3091+
Use cryptography's X509 APIs instead.
30623092
"""
30633093
if isinstance(buffer, str):
30643094
buffer = buffer.encode("ascii")

0 commit comments

Comments
 (0)