xref: /freebsd/crypto/openssl/doc/man3/SSL_CTX_set_keylog_callback.pod (revision 7ef62cebc2f965b0f640263e179276928885e33d)
1=pod
2
3=head1 NAME
4
5SSL_CTX_set_keylog_callback, SSL_CTX_get_keylog_callback,
6SSL_CTX_keylog_cb_func - logging TLS key material
7
8=head1 SYNOPSIS
9
10 #include <openssl/ssl.h>
11
12 typedef void (*SSL_CTX_keylog_cb_func)(const SSL *ssl, const char *line);
13
14 void SSL_CTX_set_keylog_callback(SSL_CTX *ctx, SSL_CTX_keylog_cb_func cb);
15 SSL_CTX_keylog_cb_func SSL_CTX_get_keylog_callback(const SSL_CTX *ctx);
16
17=head1 DESCRIPTION
18
19SSL_CTX_set_keylog_callback() sets the TLS key logging callback. This callback
20is called whenever TLS key material is generated or received, in order to allow
21applications to store this keying material for debugging purposes.
22
23SSL_CTX_get_keylog_callback() retrieves the previously set TLS key logging
24callback. If no callback has been set, this will return NULL. When there is no
25key logging callback, or if SSL_CTX_set_keylog_callback is called with NULL as
26the value of cb, no logging of key material will be done.
27
28The key logging callback is called with two items: the B<ssl> object associated
29with the connection, and B<line>, a string containing the key material in the
30format used by NSS for its B<SSLKEYLOGFILE> debugging output. To recreate that
31file, the key logging callback should log B<line>, followed by a newline.
32B<line> will always be a NUL-terminated string.
33
34=head1 RETURN VALUES
35
36SSL_CTX_get_keylog_callback() returns a pointer to B<SSL_CTX_keylog_cb_func> or
37NULL if the callback is not set.
38
39=head1 SEE ALSO
40
41L<ssl(7)>
42
43=head1 COPYRIGHT
44
45Copyright 2016-2021 The OpenSSL Project Authors. All Rights Reserved.
46
47Licensed under the Apache License 2.0 (the "License").  You may not use
48this file except in compliance with the License.  You can obtain a copy
49in the file LICENSE in the source distribution or at
50L<https://www.openssl.org/source/license.html>.
51
52=cut
53