<div dir="ltr">Thank you all.. i will try and write back.<div><br></div><div>-thanks</div><div>harish</div><div><br></div></div><br><div class="gmail_quote"><div dir="ltr" class="gmail_attr">On Wed, Mar 10, 2021 at 7:59 PM Matt Caswell <<a href="mailto:matt@openssl.org">matt@openssl.org</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><br>
<br>
On 10/03/2021 13:35, Jeremy Harris wrote:<br>
> On 10/03/2021 13:14, Harish Kulkarni wrote:<br>
>> My application is built along with openssl library source code. We <br>
>> want to<br>
>> dump keys to a file for decrypting TLS flows from network captures.. is<br>
>> there any flag or environment variable which we can set during building<br>
>> application or while running application.<br>
> <br>
> Env var SSLKEYLOGFILE<br>
<br>
That is not an OpenSSL environment variable (I think that's an NSS thing).<br>
<br>
In order to log keys you need to set the key logging callback via <br>
SSL_CTX_set_keylog_callback.<br>
<br>
The callback needs to look like this:<br>
<br>
typedef void (*SSL_CTX_keylog_cb_func)(const SSL *ssl, const char *line);<br>
<br>
It should write the data provided in "line" to wherever you want to <br>
store the key data.<br>
<br>
See:<br>
<a href="https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_keylog_callback.html" rel="noreferrer" target="_blank">https://www.openssl.org/docs/man1.1.1/man3/SSL_CTX_set_keylog_callback.html</a><br>
<br>
If you are using the OpenSSL command line then you can use the <br>
"-keylogfile" option to s_client or s_server to specify the filename for <br>
where you want keys logged.<br>
<br>
Matt<br>
</blockquote></div>