title: Decrypt TLS https data traffic
body: <p>I have implemented a Java network packet sniffer similar to that proposed by 
  <a href="http://www.freeproject.co.in/source/Network-Packet-Sniffer.aspx?pf=Java&amp;t=web">http://www.freeproject.co.in/source/Network-Packet-Sniffer.aspx?pf=Java&amp;t=web</a> or
  <a href="http://packetsnifferusingjpcap.blogspot.it/">http://packetsnifferusingjpcap.blogspot.it/</a></p>
  
  <p>Now I would like to decrypt the data stream coming from an https, in an attempt to do so I set the variable SSLKEYLOGFILE, in this way the browser will write the values used to generate TLS session keys out to a file indicated by this variable see <a href="https://isc.sans.edu/forums/diary/Psst+Your+Browser+Knows+All+Your+Secrets/16415/">https://isc.sans.edu/forums/diary/Psst+Your+Browser+Knows+All+Your+Secrets/16415/</a></p>
  
  <p>As it is explained in <a href="https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/Key_Log_Format">https://developer.mozilla.org/en-US/docs/Mozilla/Projects/NSS/Key_Log_Format</a></p>
  
  <p>The file indicated by SSLKEYLOGFILE is a series of lines. Comment lines begin with a sharp character ('#'). Otherwise the line takes one of these formats.</p>
  
  <pre><code>RSA &lt;space&gt; &lt;16 bytes of hex encoded encrypted pre master secret&gt; &lt;space&gt; &lt;96 bytes of hex encoded pre master secret&gt;
  
  CLIENT_RANDOM &lt;space&gt; &lt;64 bytes of hex encoded client_random&gt; &lt;space&gt; &lt;96 bytes of hex encoded master secret&gt;
  </code></pre>
  
  <p>How can I use the SSL / TLS secrets log file in order to decrypt network packages in a java code ?</p>