Skip to content

Commit

Permalink
Deprecate sign() and verify() (#1256)
Browse files Browse the repository at this point in the history
  • Loading branch information
alex committed Oct 2, 2023
1 parent 8bfe5df commit d129af2
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 0 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.rst
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ Deprecations:
- Deprecated ``OpenSSL.crypto.CRL``
- Deprecated ``OpenSSL.crypto.Revoked``
- Deprecated ``OpenSSL.crypto.load_crl`` and ``OpenSSL.crypto.dump_crl``
- Deprecated ``OpenSSL.crypto.sign`` and ``OpenSSL.crypto.verify``

Changes:
^^^^^^^^
Expand Down
18 changes: 18 additions & 0 deletions src/OpenSSL/crypto.py
Original file line number Diff line number Diff line change
Expand Up @@ -3149,6 +3149,15 @@ def sign(pkey: PKey, data: Union[str, bytes], digest: str) -> bytes:
return _ffi.buffer(signature_buffer, signature_length[0])[:]


utils.deprecated(
sign,
__name__,
"sign() is deprecated. Use the equivilant APIs in cryptography.",
DeprecationWarning,
name="sign",
)


def verify(
cert: X509, signature: bytes, data: Union[str, bytes], digest: str
) -> None:
Expand Down Expand Up @@ -3187,6 +3196,15 @@ def verify(
_raise_current_error()


utils.deprecated(
verify,
__name__,
"verify() is deprecated. Use the equivilant APIs in cryptography.",
DeprecationWarning,
name="verify",
)


def dump_crl(type: int, crl: CRL) -> bytes:
"""
Dump a certificate revocation list to a buffer.
Expand Down

0 comments on commit d129af2

Please sign in to comment.