I am trying to export/write the SSL master secret and keys to a file from the chromium browser. I would appreciate if someone could advice me how to do this.
To write the premaster secret we can simply export the SSLKEYLOGFILE variable in the environment. The premaster secrets can be used by wireshark to decrypt an HTTPS session.
The premaster secret is used to compute the master secret which is further used to create 6 keys - CLIENT_WRITE_MAC CLIENT_IV CLIENT_WRITE and 3 more for the server.
I want to output these keys to a file instead of the premaster secret.
I figured if I could use wireshark code to simply output it but this is more complex I believe the code for wireshark handling SSL packets and using the premaster secret is in here. github.com/boundary/wireshark/blob/master/epan/dissectors/packet-ssl-utils.c
Another way to proceed is to make changes to the chromium browser and compile it. I think changes need to be made here. https://code.google.com/p/chromium/codesearch#chromium/src/net/third_party/nss/ssl/derive.c&q=client_write_mac_secret&sq=package:chromium&type=cs&l=214
I was going through more source code and I found this file to be related.
Looking at the code above I notice that there are more environment variables that can be set. Does anybody know if the SSLDEBUG environment can be set in the same way as the SSLKEYLOG variable. Any other way or technique to do this would help also
I have not been able to successfully do export the keys so far.