SSL_CTX_SET_KEYLOG_CALLBACK(3ossl)
π SSL_CTX_SET_KEYLOG_CALLBACK β the OpenSSL one, bestie
okay so this is a page from the OpenSSL manual (you know, the cryptography girlies) and it's all about SSL_CTX_set_keylog_callback, SSL_CTX_get_keylog_callback and SSL_CTX_keylog_cb_func β aka logging TLS key material. yes, we're spying on our own handshake. for science. π§
β¨ NAME β¨
SSL_CTX_set_keylog_callback, SSL_CTX_get_keylog_callback, SSL_CTX_keylog_cb_func β logging TLS key material π
πΈ SYNOPSIS πΈ
#include <openssl/ssl.h>
typedef void (*SSL_CTX_keylog_cb_func)(const SSL *ssl, const char *line);
void SSL_CTX_set_keylog_callback(SSL_CTX *ctx, SSL_CTX_keylog_cb_func cb);
SSL_CTX_keylog_cb_func SSL_CTX_get_keylog_callback(const SSL_CTX *ctx);
like, copy that exactly, don't freestyle the signature, ok? π
π DESCRIPTION π
okay so SSL_CTX_set_keylog_callback() sets the TLS key logging callback. this callback gets called whenever TLS key material is generated or received β the whole point is letting applications stash that keying material away for debugging purposes. it's giving detective energy π
SSL_CTX_get_keylog_callback() retrieves the previously set TLS key logging callback. and if no callback has been set? it returns NULL. simple as that. and when there's no key logging callback at all β or if SSL_CTX_set_keylog_callback gets called with NULL as the value of cb β then no logging of key material will be done. zero. nada. the vibes are silent π«Ά
now the callback itself gets called with two items:
- the
sslobject associated with the connection π line, a string containing the key material in the format used by NSS for itsSSLKEYLOGFILEdebugging output
and to recreate that file, the key logging callback should log line, followed by a newline. also important, bestie: line will always be a NUL-terminated string. no cap. β¨
π¦ RETURN VALUES π¦
SSL_CTX_get_keylog_callback() returns a pointer to SSL_CTX_keylog_cb_func, or NULL if the callback is not set. that's it, that's the whole return situation π
π SEE ALSO π
π COPYRIGHT π
Copyright 2016-2018 The OpenSSL Project Authors. All Rights Reserved.
Licensed under the Apache License 2.0 (the "License"). You may not use this file except in compliance with the License. You can obtain a copy in the file LICENSE in the source distribution or at <https://www.openssl.org/source/license.html>.
and that's the whole page, periodt π this was OpenSSL manual page 3.5.9, dated 2026-09-29 β go forth and log those keys responsibly, my love πΈπ¦β
π¦ where this page comes from
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 43: openssl-devel 1:3.5.9-1.fc43 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- fedora 44: openssl-devel 1:3.5.9-1.fc44 Β· Apache-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms