<div dir="ltr"><div>Hi Xuelei,</div><div><br></div><div>>There are a few protocols that can benefits from exporting SSL/TLS handshake materials, including RFC 5929, RFC 5056, token binding and TLS 1.3 itself. Can we define a general API so as to exposing the handshake materials, so as to mitigate the inflating of JSSE APIs? I may suggest make further evaluation before move on to following design and code.</div><div><br></div><div>Do you prefer an API like "public byte[] getTlsHandshakeMaterial(String materialType)" (in SSLSocket and SSLEngine) where "materialType" can eventually be "clientFinishedMessage"/"finishedMessage" or "serverFinishedMessage"/"peerFinishedMessage"? I cannot think of "serverCertificate" or "masterKey" as this is more related to a Session and not neccessarily to a handshake. getTlsHandshakeMaterial would be a lower level API and would move the burden of knowing which information is required for "tls-unique" TLS channel binding to the API consumer. Looks more like the OpenSSL approach (instead of the Python, SSLBoring or GnuTls approaches). However, OpenSSL have specific methods for each piece of information instead of a generic and parametrized one. I.e.: SSL_get_finished or SSL_get_peer_finished. What other information do you expect the Handshaker to provide?</div><div><br></div><div>>The SunJSSE provider happens to cache the finished messages in its implementation so you can use it for tls-unique, but it may not be true for other provider or other channel bindings. Need to define a more reliable approach to get the handshake materials.</div><div><br></div><div>I focused on SunJSSE provider. I'm not sure about how other providers may implement this API and where they can get the required information from, without knowing their internals. In regard to SunJSSE and "tls-unique" binding type, I leveraged on existing data. If data weren't already there, I would have to figure out how to get it from the handshake -doing the same that was already done would have been an option-. Do you prefer the Handshaker to provide a function to get different information and not just the finished hash? (as for the public SSLSocket/SSLEngine "getTlsHandshakeMaterial" API). Which other information may be useful to get from the Handshaker? What do you mean by reliable? (given that this is all SunJSSE internal and we have no external dependencies).</div><div><br></div><div>In regard to other channel bindings, it'll depend on the binding type the way in which the information is obtained. I.e.: "tls-unique" SunJSSE implementation leverages on cached finished messages. However, "tls-server-end-point" leverages on stored certificates that are obtained from the Session (not from the handshaker). Is there any specific channel binding you are concerned with?</div><div><br></div><div>>If the channel binding is not required, it may be not necessary to expose the handshake materials. Need to define a solution to indicate the need of the exporting.</div><div><br></div><div>Do you mean a lower layer knowing if the upper layer is going to require that information and decide to provide it or not based on that knowledge? I think I didn't get your point here.</div><div><br></div><div>>2. No way to know the update of the underlying handshake materials.</div><div>>If renegotiation can takes place, need to define a interface to indicate that so that application can response accordingly. See section 3 and 7 of RFC 5929.</div><div><br></div><div>I intentionally skipped this -at the cost of a spurious authentication- to avoid adding complexity to the API. An spurious authentication -which does not appear likely to me- can easily be retried by the application. The RFC 5929 suggests APIs through which the application can *control* the flow (i.e.: hold a renegotitation). This would expose JSSE internals. This is more than notifying. Notification, in my opinion, adds no value: what if the application already used the binding token before receiving the notification? The spurious authentication will happen anyways and has to be handled -i.e. retried-. It's just a timing issue. The real value is controlling the flow as the RFC suggests, but at the cost of exposing JSSE internals.</div><div><br></div><div>Kind regards,</div><div>Martin.-</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Aug 26, 2017 at 5:25 PM, Xuelei Fan <span dir="ltr"><<a href="mailto:xuelei.fan@oracle.com" target="_blank">xuelei.fan@oracle.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi Marin,<br>
<br>
Sorry for the delay.<br>
<br>
There are a few protocols that can benefits from exporting SSL/TLS handshake materials, including RFC 5929, RFC 5056, token binding and TLS 1.3 itself. Can we define a general API so as to exposing the handshake materials, so as to mitigate the inflating of JSSE APIs? I may suggest make further evaluation before move on to following design and code.<br>
<br>
> <a href="http://cr.openjdk.java.net/~sgehwolf/webrevs/mbalaoal/JDK-6491070/webrev.02/" rel="noreferrer" target="_blank">http://cr.openjdk.java.net/~sg<wbr>ehwolf/webrevs/mbalaoal/JDK-64<wbr>91070/webrev.02/</a><br>
I have two concerns about the design:<br>
<br>
1. Channel binding may be not always required.<br>
SSLSocket/SSLEngine.getTlsChan<wbr>nelBinding(String bindingType);<br>
<br>
The SunJSSE provider happens to cache the finished messages in its implementation so you can use it for tls-unique, but it may not be true for other provider or other channel bindings. Need to define a more reliable approach to get the handshake materials.<br>
<br>
If the channel binding is not required, it may be not necessary to expose the handshake materials. Need to define a solution to indicate the need of the exporting.<br>
<br>
2. No way to know the update of the underlying handshake materials.<br>
If renegotiation can takes place, need to define a interface to indicate that so that application can response accordingly. See section 3 and 7 of RFC 5929.<br>
<br>
Thanks,<br>
Xuelei<span class=""><br>
<br>
On 7/31/2017 8:53 AM, Martin Balao wrote:<br>
</span><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">
Hi,<br>
<br>
Here it is an update for the proposed TLS Channel Bindings support in OpenJDK:<br>
<br>
* <a href="http://cr.openjdk.java.net/~sgehwolf/webrevs/mbalaoal/JDK-6491070/webrev.02/" rel="noreferrer" target="_blank">http://cr.openjdk.java.net/~sg<wbr>ehwolf/webrevs/mbalaoal/JDK-64<wbr>91070/webrev.02/</a> (browse online)<br>
* <a href="http://cr.openjdk.java.net/~sgehwolf/webrevs/mbalaoal/JDK-6491070/webrev.02/6491070.webrev.02.zip" rel="noreferrer" target="_blank">http://cr.openjdk.java.net/~sg<wbr>ehwolf/webrevs/mbalaoal/JDK-64<wbr>91070/webrev.02/6491070.webrev<wbr>.02.zip</a> (download)<br>
<br>
Changes since v01:<br>
<br>
* getTlsChannelBinding API changed to return null by default (if not implemented), instead of throwing an UnsupportedOperationException.<br>
<br>
* "tls-server-end-point" TLS channel binding now supported.<br>
<br>
Kind regards,<br>
Martin.-<br>
<br></span><span class="">
On Wed, Jul 26, 2017 at 4:12 PM, Martin Balao <<a href="mailto:mbalao@redhat.com" target="_blank">mbalao@redhat.com</a> <mailto:<a href="mailto:mbalao@redhat.com" target="_blank">mbalao@redhat.com</a>>> wrote:<br>
<br>
Hi,<br>
<br>
Here it is my proposal for JDK-6491070 (Support for RFC 5929-Channel<br>
Bindings: e.g. public API to obtain TLS finished message) [1]:<br>
<br>
*<br>
<a href="http://cr.openjdk.java.net/~sgehwolf/webrevs/mbalaoal/JDK-6491070/webrev.01/" rel="noreferrer" target="_blank">http://cr.openjdk.java.net/~sg<wbr>ehwolf/webrevs/mbalaoal/JDK-64<wbr>91070/webrev.01/</a><br>
<<a href="http://cr.openjdk.java.net/~sgehwolf/webrevs/mbalaoal/JDK-6491070/webrev.01/" rel="noreferrer" target="_blank">http://cr.openjdk.java.net/~s<wbr>gehwolf/webrevs/mbalaoal/JDK-6<wbr>491070/webrev.01/</a>><br>
*<br>
<a href="http://cr.openjdk.java.net/~sgehwolf/webrevs/mbalaoal/JDK-6491070/webrev.01/6491070.webrev.01.zip" rel="noreferrer" target="_blank">http://cr.openjdk.java.net/~sg<wbr>ehwolf/webrevs/mbalaoal/JDK-64<wbr>91070/webrev.01/6491070.webrev<wbr>.01.zip</a><br>
<<a href="http://cr.openjdk.java.net/~sgehwolf/webrevs/mbalaoal/JDK-6491070/webrev.01/6491070.webrev.01.zip" rel="noreferrer" target="_blank">http://cr.openjdk.java.net/~s<wbr>gehwolf/webrevs/mbalaoal/JDK-6<wbr>491070/webrev.01/6491070.webre<wbr>v.01.zip</a>><br>
<br>
Notes:<br>
* Implementation based on Channel Bindings for TLS (RFC 5929) [2]<br>
<br>
* Only "tls-unique" currently supported<br>
<br>
Look forward to your comments.<br>
<br>
Kind regards,<br>
Martin.-<br>
<br>
--<br>
[1] - <a href="https://bugs.openjdk.java.net/browse/JDK-6491070" rel="noreferrer" target="_blank">https://bugs.openjdk.java.net/<wbr>browse/JDK-6491070</a><br>
<<a href="https://bugs.openjdk.java.net/browse/JDK-6491070" rel="noreferrer" target="_blank">https://bugs.openjdk.java.net<wbr>/browse/JDK-6491070</a>><br>
[2] - <a href="https://tools.ietf.org/html/rfc5929" rel="noreferrer" target="_blank">https://tools.ietf.org/html/rf<wbr>c5929</a><br></span>
<<a href="https://tools.ietf.org/html/rfc5929" rel="noreferrer" target="_blank">https://tools.ietf.org/html/r<wbr>fc5929</a>><br>
<br>
<br>
</blockquote>
</blockquote></div><br></div>