Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deprecate sign() and verify() #1256

Merged
merged 1 commit into from Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.rst
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
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