Skip to content

Commit bb971ae

Browse files
authored
Deprecated pkcs7 and pkcs12 support (#921)
1 parent 41dc136 commit bb971ae

File tree

2 files changed

+25
-1
lines changed

2 files changed

+25
-1
lines changed

CHANGELOG.rst

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,8 @@ Backward-incompatible changes:
1919
Deprecations:
2020
^^^^^^^^^^^^^
2121

22+
- Deprecated ``OpenSSL.crypto.loads_pkcs7`` and ``OpenSSL.crypto.loads_pkcs12``.
23+
2224
*none*
2325

2426

src/OpenSSL/crypto.py

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
PY2 as _PY2,
1111
)
1212

13-
from cryptography import x509
13+
from cryptography import utils, x509
1414
from cryptography.hazmat.primitives.asymmetric import dsa, rsa
1515

1616
from OpenSSL._util import (
@@ -3010,6 +3010,17 @@ def load_pkcs7_data(type, buffer):
30103010
return pypkcs7
30113011

30123012

3013+
load_pkcs7_data = utils.deprecated(
3014+
load_pkcs7_data,
3015+
__name__,
3016+
(
3017+
"PKCS#7 support in pyOpenSSL is deprecated. You should use the APIs "
3018+
"in cryptography."
3019+
),
3020+
DeprecationWarning,
3021+
)
3022+
3023+
30133024
def load_pkcs12(buffer, passphrase=None):
30143025
"""
30153026
Load pkcs12 data from the string *buffer*. If the pkcs12 structure is
@@ -3097,6 +3108,17 @@ def load_pkcs12(buffer, passphrase=None):
30973108
return pkcs12
30983109

30993110

3111+
load_pkcs12 = utils.deprecated(
3112+
load_pkcs12,
3113+
__name__,
3114+
(
3115+
"PKCS#12 support in pyOpenSSL is deprecated. You should use the APIs "
3116+
"in cryptography."
3117+
),
3118+
DeprecationWarning,
3119+
)
3120+
3121+
31003122
# There are no direct unit tests for this initialization. It is tested
31013123
# indirectly since it is necessary for functions like dump_privatekey when
31023124
# using encryption.

0 commit comments

Comments
 (0)