@@ -2349,6 +2349,19 @@ def get_rev_date(self) -> Optional[bytes]:
2349
2349
return _get_asn1_time (dt )
2350
2350
2351
2351
2352
+ _RevokedInternal = Revoked
2353
+ utils .deprecated (
2354
+ Revoked ,
2355
+ __name__ ,
2356
+ (
2357
+ "CRL support in pyOpenSSL is deprecated. You should use the APIs "
2358
+ "in cryptography."
2359
+ ),
2360
+ DeprecationWarning ,
2361
+ name = "Revoked" ,
2362
+ )
2363
+
2364
+
2352
2365
class CRL :
2353
2366
"""
2354
2367
A certificate revocation list.
@@ -2368,7 +2381,7 @@ def to_cryptography(self) -> x509.CertificateRevocationList:
2368
2381
"""
2369
2382
from cryptography .x509 import load_der_x509_crl
2370
2383
2371
- der = dump_crl (FILETYPE_ASN1 , self )
2384
+ der = _dump_crl_internal (FILETYPE_ASN1 , self )
2372
2385
return load_der_x509_crl (der )
2373
2386
2374
2387
@classmethod
@@ -2391,9 +2404,9 @@ def from_cryptography(
2391
2404
from cryptography .hazmat .primitives .serialization import Encoding
2392
2405
2393
2406
der = crypto_crl .public_bytes (Encoding .DER )
2394
- return load_crl (FILETYPE_ASN1 , der )
2407
+ return _load_crl_internal (FILETYPE_ASN1 , der )
2395
2408
2396
- def get_revoked (self ) -> Optional [Tuple [Revoked , ...]]:
2409
+ def get_revoked (self ) -> Optional [Tuple [_RevokedInternal , ...]]:
2397
2410
"""
2398
2411
Return the revocations in this certificate revocation list.
2399
2412
@@ -2408,7 +2421,7 @@ def get_revoked(self) -> Optional[Tuple[Revoked, ...]]:
2408
2421
for i in range (_lib .sk_X509_REVOKED_num (revoked_stack )):
2409
2422
revoked = _lib .sk_X509_REVOKED_value (revoked_stack , i )
2410
2423
revoked_copy = _lib .X509_REVOKED_dup (revoked )
2411
- pyrev = Revoked .__new__ (Revoked )
2424
+ pyrev = _RevokedInternal .__new__ (_RevokedInternal )
2412
2425
pyrev ._revoked = _ffi .gc (revoked_copy , _lib .X509_REVOKED_free )
2413
2426
results .append (pyrev )
2414
2427
if results :
@@ -2578,7 +2591,20 @@ def export(
2578
2591
if not sign_result :
2579
2592
_raise_current_error ()
2580
2593
2581
- return dump_crl (type , self )
2594
+ return _dump_crl_internal (type , self )
2595
+
2596
+
2597
+ _CRLInternal = CRL
2598
+ utils .deprecated (
2599
+ CRL ,
2600
+ __name__ ,
2601
+ (
2602
+ "CRL support in pyOpenSSL is deprecated. You should use the APIs "
2603
+ "in cryptography."
2604
+ ),
2605
+ DeprecationWarning ,
2606
+ name = "CRL" ,
2607
+ )
2582
2608
2583
2609
2584
2610
class PKCS12 :
@@ -3190,6 +3216,19 @@ def dump_crl(type: int, crl: CRL) -> bytes:
3190
3216
return _bio_to_string (bio )
3191
3217
3192
3218
3219
+ _dump_crl_internal = dump_crl
3220
+ utils .deprecated (
3221
+ dump_crl ,
3222
+ __name__ ,
3223
+ (
3224
+ "CRL support in pyOpenSSL is deprecated. You should use the APIs "
3225
+ "in cryptography."
3226
+ ),
3227
+ DeprecationWarning ,
3228
+ name = "dump_crl" ,
3229
+ )
3230
+
3231
+
3193
3232
def load_crl (type : int , buffer : Union [str , bytes ]) -> CRL :
3194
3233
"""
3195
3234
Load Certificate Revocation List (CRL) data from a string *buffer*.
@@ -3215,6 +3254,19 @@ def load_crl(type: int, buffer: Union[str, bytes]) -> CRL:
3215
3254
if crl == _ffi .NULL :
3216
3255
_raise_current_error ()
3217
3256
3218
- result = CRL .__new__ (CRL )
3257
+ result = _CRLInternal .__new__ (_CRLInternal )
3219
3258
result ._crl = _ffi .gc (crl , _lib .X509_CRL_free )
3220
3259
return result
3260
+
3261
+
3262
+ _load_crl_internal = load_crl
3263
+ utils .deprecated (
3264
+ load_crl ,
3265
+ __name__ ,
3266
+ (
3267
+ "CRL support in pyOpenSSL is deprecated. You should use the APIs "
3268
+ "in cryptography."
3269
+ ),
3270
+ DeprecationWarning ,
3271
+ name = "load_crl" ,
3272
+ )
0 commit comments