Skip to content

Add opt-in OpenSSL TLS key logging for clients and servers - #661

Merged
bsergean merged 1 commit into
masterfrom
feature/openssl-key-log
Nov 18, 2026
Merged

bsergean merged 1 commit into
masterfrom
feature/openssl-key-log

Conversation

@bsergean

Copy link
Copy Markdown
Collaborator

Add opt-in TLS session key logging through SocketTLSOptions::keyLogFile for OpenSSL 1.1.1 and newer, for clients and servers. ws TLS commands expose --keylog-file and SSLKEYLOGFILE, with the command-line option taking precedence. Empty options keep library logging disabled, and unsupported backends report an explicit error.

Each TLS context retains its socket's configuration through OpenSSL's application-data API. The callback appends NSS-format lines, serializes appends when connections share a file, and preserves the socket error state. There is no global connection/context lookup table. An unwritable destination fails connection initialization; callback exceptions do not cross the C API. API and CLI usage are documented.

Closes #499.

Validation:

  • Fast memory-BIO tests exercise TLS 1.2/1.3, client/server secrets, separate/shared files, three successive connections, concurrent appends, existing content, disabled logging, unwritable destinations and socket error preservation. New cases take 1–10 ms and use no sleeps.
  • Full OpenSSL 3.6 library/CLI suite: 33/33 passed. OpenSSL 1.1.1 adapter suite passes with deprecated declarations disabled. The adapter suite passed five consecutive ThreadSanitizer runs.
  • Real TLS 1.3 CLI smoke tests verify matching client/server key records over three connections, including option, environment and precedence cases.
  • Native Network.framework/socket tests pass, including explicit rejection of unsupported key logging on native clients and servers.
  • C++11 production/CLI builds with warnings as errors; formatting check passes.

@bsergean bsergean added the enhancement New feature or request label Nov 18, 2026
@bsergean
bsergean merged commit c1a1db3 into master Nov 18, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] Add support for OpenSSL SSLKEYLOGFILE

1 participant