<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;font-family:Calibri,Arial,Helvetica,sans-serif;" dir="ltr">
<p>Hi,</p>
<p><br>
</p>
<p>Is it a solution to for you to deal with it on the client side?</p>
<p><br>
</p>
<p><a class="OWAAutoLink" id="LPlnk962117" href="https://jimshaver.net/2015/02/11/decrypting-tls-browser-traffic-with-wireshark-the-easy-way/" previewremoved="true">https://jimshaver.net/2015/02/11/decrypting-tls-browser-traffic-with-wireshark-the-easy-way/</a></p>
<br>
<p>Chrome lets you write keys out.<br>
</p>
<br>
<br>
<div style="color: rgb(0, 0, 0);">
<div>
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="x_divRplyFwdMsg" dir="ltr"><font color="#000000" face="Calibri, sans-serif" style="font-size:11pt"><b>From:</b> erlang-questions-bounces@erlang.org <erlang-questions-bounces@erlang.org> on behalf of Roger Lipscombe <roger@differentpla.net><br>
<b>Sent:</b> Friday, 6 January 2017 1:20 AM<br>
<b>To:</b> erlang-questions@erlang.org<br>
<b>Subject:</b> [erlang-questions] SSL: Getting master_secret and client_random (or premaster_secret)</font>
<div> </div>
</div>
</div>
<font size="2"><span style="font-size:10pt;">
<div class="PlainText">We're using ECDHE and DHE ciphers for our SSL connections. This<br>
provides perfect forward secrecy, which is good, but it makes it<br>
impossible to decipher packet captures in wireshark, which is<br>
expected, and also good, almost all of the time.<br>
<br>
Sometimes, however, we *do* need to decipher the traffic.<br>
<br>
Note that we own both the client (which is embedded) and the server<br>
(which uses Erlang -- otherwise I wouldn't be asking here -- and<br>
ranch). We *could* offer a different cipher suite on the server, which<br>
would disable PFS, but would do it for all connections. I'd prefer<br>
something a bit more fine-grained.<br>
<br>
You can feed a key log to Wireshark, as documented at<br>
<a id="LPlnk105502" href="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/Key_Log_Format" previewremoved="true">https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/Key_Log_Format</a>,
<div id="LPBorder_GT_14836579749510.7550493720960958" style="width: 100%; text-indent: 0px; overflow: auto; margin-bottom: 20px;">
<table id="LPContainer_14836579749480.09298413908458358" style="width: 90%; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top-color: rgb(200, 200, 200); border-bottom-color: rgb(200, 200, 200); border-top-width: 1px; border-bottom-width: 1px; border-top-style: dotted; border-bottom-style: dotted; position: relative; background-color: rgb(255, 255, 255);" cellspacing="0">
<tbody>
<tr valign="top" style="border-spacing: 0px;">
<td id="ImageCell_14836579749480.8447368874211827" style="width: 250px; padding-right: 20px; display: table-cell; position: relative;" colspan="1">
<div id="LPImageContainer_14836579749490.25111797783830303" style="margin: auto; width: 250px; height: 250px; display: table; position: relative; background-color: rgb(255, 255, 255);">
<a id="LPImageAnchor_14836579749490.8039190045842564" style="text-align: center; display: table-cell;" href="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/Key_Log_Format" target="_blank"><img width="250" height="250" id="LPThumbnailImageID_14836579749490.7090204134466074" style="border-width: 0px; width: 250px; height: 250px; vertical-align: bottom; display: inline-block; max-height: 250px; max-width: 250px;" aria-label="Preview image with link selected. Double-tap to open the link." src="https://developer.cdn.mozilla.net/static/img/opengraph-logo.dc4e08e2f6af.png"></a></div>
</td>
<td id="TextCell_14836579749500.29855108854098766" style="padding: 0px; vertical-align: top; display: table-cell; position: relative;" colspan="2">
<div id="LPRemovePreviewContainer_14836579749500.9195631725782705"></div>
<div id="LPTitle_14836579749500.6988805004338934" style="top: 0px; color: rgb(0, 120, 215); line-height: 21px; font-family: "wf_segoe-ui_light","Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size: 21px; font-weight: 400;">
<a id="LPUrlAnchor_14836579749500.7745176820296251" style="text-decoration: none;" href="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/Key_Log_Format" target="_blank">NSS Key Log Format - Mozilla | MDN</a></div>
<div id="LPMetadata_14836579749500.03182663631745308" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); line-height: 14px; font-family: "wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size: 14px; font-weight: 400;">
developer.mozilla.org</div>
<div id="LPDescription_14836579749510.1172308378173681" style="color: rgb(102, 102, 102); line-height: 20px; overflow: hidden; font-family: "wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size: 14px; font-weight: 400; display: block; max-height: 100px;">
Key logs can be written by NSS so that external programs can decrypt TLS connections. Wireshark 1.6.0 and above can use these log files to decrypt packets.</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
and it'll correctly decipher the traffic for that connection.<br>
<br>
I'd like to find a way to generate a key log file. This requires<br>
either (client_random, master_secret) or (encrypted_premaster_secret,<br>
premaster_secret).<br>
<br>
Note that I'm looking at the OTP 17.5 source, because that's what we're using.<br>
<br>
It would seem that premaster_secret is not stored past the initial<br>
negotiation, but the client_random and master_secret values are in the<br>
#security_parameters record in the #connection_state record in the<br>
#connection_states record, which is in the #state record of the SSL<br>
connection pid.<br>
<br>
But I can't see any (clean) way to retrieve these values, in order to<br>
generate a key log suitable for Wireshark.<br>
<br>
Is there any clean way to do this in OTP 17.5, or is there a supported<br>
way to do this in OTP 18.x or 19.x?<br>
<br>
Regards,<br>
Roger.<br>
_______________________________________________<br>
erlang-questions mailing list<br>
erlang-questions@erlang.org<br>
<a id="LPlnk900480" href="http://erlang.org/mailman/listinfo/erlang-questions" previewremoved="true">http://erlang.org/mailman/listinfo/erlang-questions</a>
<div id="LPBorder_GT_14836579749570.8380948533698385" style="width: 100%; text-indent: 0px; overflow: auto; margin-bottom: 20px;">
<table id="LPContainer_14836579749560.5839414675615475" style="width: 90%; overflow: auto; padding-top: 20px; padding-bottom: 20px; margin-top: 20px; border-top-color: rgb(200, 200, 200); border-bottom-color: rgb(200, 200, 200); border-top-width: 1px; border-bottom-width: 1px; border-top-style: dotted; border-bottom-style: dotted; position: relative; background-color: rgb(255, 255, 255);" cellspacing="0">
<tbody>
<tr valign="top" style="border-spacing: 0px;">
<td id="TextCell_14836579749560.6789299028237197" style="padding: 0px; vertical-align: top; display: table-cell; position: relative;" colspan="2">
<div id="LPRemovePreviewContainer_14836579749560.14563166379937442"></div>
<div id="LPTitle_14836579749560.907391741878246" style="top: 0px; color: rgb(0, 120, 215); line-height: 21px; font-family: "wf_segoe-ui_light","Segoe UI Light","Segoe WP Light","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size: 21px; font-weight: 400;">
<a id="LPUrlAnchor_14836579749570.8216478403417253" style="text-decoration: none;" href="http://erlang.org/mailman/listinfo/erlang-questions" target="_blank">erlang-questions Info Page</a></div>
<div id="LPMetadata_14836579749570.7748328154702788" style="margin: 10px 0px 16px; color: rgb(102, 102, 102); line-height: 14px; font-family: "wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size: 14px; font-weight: 400;">
erlang.org</div>
<div id="LPDescription_14836579749570.874842404560624" style="color: rgb(102, 102, 102); line-height: 20px; overflow: hidden; font-family: "wf_segoe-ui_normal","Segoe UI","Segoe WP",Tahoma,Arial,sans-serif; font-size: 14px; font-weight: 400; display: block; max-height: 100px;">
Mailing list for general discussions about Erlang/OTP, the language, implementation, usage, beginners questions, etc... To see the collection of prior postings to the ...</div>
</td>
</tr>
</tbody>
</table>
</div>
<br>
<br>
</div>
</span></font></div>
</div>
</body>
</html>