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

Add SSL.Context.set_keylog_callback #910

Merged
merged 4 commits into from
Jul 28, 2020
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
make it black
  • Loading branch information
mhils committed Jul 28, 2020
commit 5c22e93f7ea759b4e7cce979ca5fc44ebc11145c
9 changes: 3 additions & 6 deletions src/OpenSSL/SSL.py
Original file line number Diff line number Diff line change
Expand Up @@ -1358,19 +1358,16 @@ def set_keylog_callback(self, callback):
debugging output.
:return: None
"""

@wraps(callback)
def wrapper(ssl, line):
line = _ffi.string(line)
callback(Connection._reverse_mapping[ssl], line)

self._keylog_callback = _ffi.callback(
"void (*)(const SSL *, const char *)",
wrapper
)
_lib.SSL_CTX_set_keylog_callback(
self._context,
self._keylog_callback
"void (*)(const SSL *, const char *)", wrapper
)
_lib.SSL_CTX_set_keylog_callback(self._context, self._keylog_callback)

def get_app_data(self):
"""
Expand Down
2 changes: 1 addition & 1 deletion tests/test_ssl.py
Original file line number Diff line number Diff line change
Expand Up @@ -1003,7 +1003,7 @@ def info(conn, where, ret):

@pytest.mark.skipif(
not getattr(_lib, "Cryptography_HAS_KEYLOG", None),
reason="SSL_CTX_set_keylog_callback unavailable"
reason="SSL_CTX_set_keylog_callback unavailable",
)
def test_set_keylog_callback(self):
"""
Expand Down