<div dir="ltr"><div class="gmail_quote"><br><br><div dir="ltr"><div>I have a query regarding the TLS 1.3 handshake message exchange. Please provide your comments.</div><div><br></div><div><br></div>With TLS 1.3, I see that Application Data Protocol message is sent from the server side and client side (using wireshark) during the handshake. I am only performing handshake and not doing any read write operations. I see that servers and clients send application data protocol when doing just SSL_connect and SSL_accept .<div><br><div>I also know that all the messages post server hello are encrypted in TLS 1.3. So, I am not sure what data gets exchanged</div><div>When checking logs for TLS 1.2, I do not see any exchange of Application Data Protocol which is as expected.</div></div><div><br></div><div><br></div><div><br></div><div>Basically, connection sequence for TLS 1.2 is </div><div><br></div><div><div class="m_264845914885871799gmail-code m_264845914885871799gmail-panel m_264845914885871799gmail-pdl" style="margin:10px 0px;padding:0px;color:rgb(51,51,51);border:1px solid rgb(204,204,204);overflow:auto;border-radius:3px;font-family:Arial,sans-serif;font-size:14px"><div class="m_264845914885871799gmail-codeHeader m_264845914885871799gmail-panelHeader m_264845914885871799gmail-pdl m_264845914885871799gmail-hide-border-bottom" style="margin:0px;padding:5px 15px;border-bottom:1px rgb(204,204,204);background:rgb(245,245,245);overflow:hidden"><b class="m_264845914885871799gmail-code-title" style="display:inline-block;padding-right:130px">Client Hello</b></div><div class="m_264845914885871799gmail-codeContent m_264845914885871799gmail-panelContent m_264845914885871799gmail-pdl m_264845914885871799gmail-hide-toolbar" style="margin:0px;padding:0px;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;line-height:20px;overflow:hidden;border-bottom-left-radius:3px;border-bottom-right-radius:3px"><div style="margin:0px;padding:0px"><div id="m_264845914885871799gmail-highlighter_811246" class="m_264845914885871799gmail-syntaxhighlighter m_264845914885871799gmail-collapsed m_264845914885871799gmail-java" style="padding:0px;width:1573px;margin:0px;overflow:visible;font-size:1em"></div></div></div></div><div class="m_264845914885871799gmail-code m_264845914885871799gmail-panel m_264845914885871799gmail-pdl" style="margin:10px 0px;padding:0px;color:rgb(51,51,51);border:1px solid rgb(204,204,204);overflow:auto;border-radius:3px;font-family:Arial,sans-serif;font-size:14px"><div class="m_264845914885871799gmail-codeHeader m_264845914885871799gmail-panelHeader m_264845914885871799gmail-pdl m_264845914885871799gmail-hide-border-bottom" style="margin:0px;padding:5px 15px;border-bottom:1px rgb(204,204,204);background:rgb(245,245,245);overflow:hidden"><b class="m_264845914885871799gmail-code-title" style="display:inline-block;padding-right:130px">Server Hello, Certificate, Server Key Exchange, Certificate Request, Server Hello Done</b></div><div class="m_264845914885871799gmail-codeContent m_264845914885871799gmail-panelContent m_264845914885871799gmail-pdl m_264845914885871799gmail-hide-toolbar" style="margin:0px;padding:0px;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;line-height:20px;overflow:hidden;border-bottom-left-radius:3px;border-bottom-right-radius:3px"><div style="margin:0px;padding:0px"><div id="m_264845914885871799gmail-highlighter_942077" class="m_264845914885871799gmail-syntaxhighlighter m_264845914885871799gmail-collapsed m_264845914885871799gmail-java" style="padding:0px;width:1573px;margin:0px;overflow:visible;font-size:1em"></div></div></div></div><div class="m_264845914885871799gmail-code m_264845914885871799gmail-panel m_264845914885871799gmail-pdl" style="margin:10px 0px;padding:0px;color:rgb(51,51,51);border:1px solid rgb(204,204,204);overflow:auto;border-radius:3px;font-family:Arial,sans-serif;font-size:14px"><div class="m_264845914885871799gmail-codeHeader m_264845914885871799gmail-panelHeader m_264845914885871799gmail-pdl m_264845914885871799gmail-hide-border-bottom" style="margin:0px;padding:5px 15px;border-bottom:1px rgb(204,204,204);background:rgb(245,245,245);overflow:hidden"><b class="m_264845914885871799gmail-code-title" style="display:inline-block;padding-right:130px">Certificate, Client Key Exchange, Certificate Verify, Change Cipher Spec, Encrypted Handshake Message (Finished)</b></div><div class="m_264845914885871799gmail-codeContent m_264845914885871799gmail-panelContent m_264845914885871799gmail-pdl m_264845914885871799gmail-hide-toolbar" style="margin:0px;padding:0px;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;line-height:20px;overflow:hidden;border-bottom-left-radius:3px;border-bottom-right-radius:3px"><div style="margin:0px;padding:0px"><div id="m_264845914885871799gmail-highlighter_569865" class="m_264845914885871799gmail-syntaxhighlighter m_264845914885871799gmail-collapsed m_264845914885871799gmail-java" style="padding:0px;width:1573px;margin:0px;overflow:visible;font-size:1em"></div></div></div></div><div class="m_264845914885871799gmail-code m_264845914885871799gmail-panel m_264845914885871799gmail-pdl" style="margin:10px 0px;padding:0px;color:rgb(51,51,51);border:1px solid rgb(204,204,204);overflow:auto;border-radius:3px;font-family:Arial,sans-serif;font-size:14px"><div class="m_264845914885871799gmail-codeHeader m_264845914885871799gmail-panelHeader m_264845914885871799gmail-pdl m_264845914885871799gmail-hide-border-bottom" style="margin:0px;padding:5px 15px;border-bottom:1px rgb(204,204,204);background:rgb(245,245,245);overflow:hidden"><b class="m_264845914885871799gmail-code-title" style="display:inline-block;padding-right:130px">Change Cipher Spec, Encrypted Handshake Message (Finished)</b><br><div><span class="m_264845914885871799expand-control-text" style="vertical-align:top;color:rgb(59,115,175)"><br></span></div></div><div class="m_264845914885871799gmail-codeContent m_264845914885871799gmail-panelContent m_264845914885871799gmail-pdl m_264845914885871799gmail-hide-toolbar" style="margin:0px;padding:0px;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;line-height:20px;overflow:hidden;border-bottom-left-radius:3px;border-bottom-right-radius:3px"><div style="margin:0px;padding:0px"><div id="m_264845914885871799gmail-highlighter_901102" class="m_264845914885871799gmail-syntaxhighlighter m_264845914885871799gmail-collapsed m_264845914885871799gmail-java" style="padding:0px;width:1573px;margin:0px;overflow:visible;font-size:1em"></div></div></div></div></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">but for TLS 1.3, it is </div><div class="gmail_extra">The same is the sequence of messages exchanged when doing a connection using resumption. I am not sure what application data gets exchanged when doing TLS 1.3 when I am not doing any read/writes.</div><div class="gmail_extra">>From RFC, I can see that Application Data can be optionally sent at the end of server Hello but I am not sure what data it is. How can I decrypt the exchanged data ?</div><div class="gmail_extra"><div class="m_264845914885871799gmail-code m_264845914885871799gmail-panel m_264845914885871799gmail-pdl" style="margin:10px 0px;padding:0px;color:rgb(51,51,51);border:1px solid rgb(204,204,204);overflow:auto;border-radius:3px;font-family:Arial,sans-serif;font-size:14px"><div class="m_264845914885871799gmail-codeHeader m_264845914885871799gmail-panelHeader m_264845914885871799gmail-pdl m_264845914885871799gmail-hide-border-bottom" style="margin:0px;padding:5px 15px;border-bottom:1px rgb(204,204,204);background:rgb(245,245,245);overflow:hidden"><b class="m_264845914885871799gmail-code-title" style="display:inline-block;padding-right:130px">Client Hello</b></div><div class="m_264845914885871799gmail-codeContent m_264845914885871799gmail-panelContent m_264845914885871799gmail-pdl m_264845914885871799gmail-hide-toolbar" style="margin:0px;padding:0px;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;line-height:20px;overflow:hidden;border-bottom-left-radius:3px;border-bottom-right-radius:3px"><div style="margin:0px;padding:0px"><div id="m_264845914885871799gmail-highlighter_728654" class="m_264845914885871799gmail-syntaxhighlighter m_264845914885871799gmail-collapsed m_264845914885871799gmail-java" style="padding:0px;width:1573px;margin:0px;overflow:visible;font-size:1em"></div></div></div></div><div class="m_264845914885871799gmail-code m_264845914885871799gmail-panel m_264845914885871799gmail-pdl" style="margin:10px 0px;padding:0px;color:rgb(51,51,51);border:1px solid rgb(204,204,204);overflow:auto;border-radius:3px;font-family:Arial,sans-serif;font-size:14px"><div class="m_264845914885871799gmail-codeHeader m_264845914885871799gmail-panelHeader m_264845914885871799gmail-pdl m_264845914885871799gmail-hide-border-bottom" style="margin:0px;padding:5px 15px;border-bottom:1px rgb(204,204,204);background:rgb(245,245,245);overflow:hidden"><b class="m_264845914885871799gmail-code-title" style="display:inline-block;padding-right:130px">Server Hello, Application Data Protocol from Server</b><br></div><div class="m_264845914885871799gmail-codeContent m_264845914885871799gmail-panelContent m_264845914885871799gmail-pdl m_264845914885871799gmail-hide-toolbar" style="margin:0px;padding:0px;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;line-height:20px;overflow:hidden;border-bottom-left-radius:3px;border-bottom-right-radius:3px"><div style="margin:0px;padding:0px"><div id="m_264845914885871799gmail-highlighter_957998" class="m_264845914885871799gmail-syntaxhighlighter m_264845914885871799gmail-collapsed m_264845914885871799gmail-java" style="padding:0px;width:1573px;margin:0px;overflow:visible;font-size:1em"></div></div></div></div><div class="m_264845914885871799gmail-code m_264845914885871799gmail-panel m_264845914885871799gmail-pdl" style="margin:10px 0px;padding:0px;color:rgb(51,51,51);border:1px solid rgb(204,204,204);overflow:auto;border-radius:3px;font-family:Arial,sans-serif;font-size:14px"><div class="m_264845914885871799gmail-codeHeader m_264845914885871799gmail-panelHeader m_264845914885871799gmail-pdl m_264845914885871799gmail-hide-border-bottom" style="margin:0px;padding:5px 15px;border-bottom:1px rgb(204,204,204);background:rgb(245,245,245);overflow:hidden"><b class="m_264845914885871799gmail-code-title" style="display:inline-block;padding-right:130px">Application Data Protocol from Client</b><br></div><div class="m_264845914885871799gmail-codeContent m_264845914885871799gmail-panelContent m_264845914885871799gmail-pdl m_264845914885871799gmail-hide-toolbar" style="margin:0px;padding:0px;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;line-height:20px;overflow:hidden;border-bottom-left-radius:3px;border-bottom-right-radius:3px"><div style="margin:0px;padding:0px"><div id="m_264845914885871799gmail-highlighter_289711" class="m_264845914885871799gmail-syntaxhighlighter m_264845914885871799gmail-collapsed m_264845914885871799gmail-java" style="padding:0px;width:1573px;margin:0px;overflow:visible;font-size:1em"></div></div></div></div><div class="m_264845914885871799gmail-code m_264845914885871799gmail-panel m_264845914885871799gmail-pdl" style="margin:10px 0px;padding:0px;color:rgb(51,51,51);border:1px solid rgb(204,204,204);overflow:auto;border-radius:3px;font-family:Arial,sans-serif;font-size:14px"><div class="m_264845914885871799gmail-codeHeader m_264845914885871799gmail-panelHeader m_264845914885871799gmail-pdl m_264845914885871799gmail-hide-border-bottom" style="margin:0px;padding:5px 15px;border-bottom:1px rgb(204,204,204);background:rgb(245,245,245);overflow:hidden"><b class="m_264845914885871799gmail-code-title" style="display:inline-block;padding-right:130px">Application Data Protocol from Server</b><br></div><div class="m_264845914885871799gmail-codeContent m_264845914885871799gmail-panelContent m_264845914885871799gmail-pdl m_264845914885871799gmail-hide-toolbar" style="margin:0px;padding:0px;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;line-height:20px;overflow:hidden;border-bottom-left-radius:3px;border-bottom-right-radius:3px"><div style="margin:0px;padding:0px"><div id="m_264845914885871799gmail-highlighter_764257" class="m_264845914885871799gmail-syntaxhighlighter m_264845914885871799gmail-collapsed m_264845914885871799gmail-java" style="padding:0px;width:1573px;margin:0px;overflow:visible;font-size:1em"></div></div></div></div><div class="m_264845914885871799gmail-code m_264845914885871799gmail-panel m_264845914885871799gmail-pdl" style="margin:10px 0px;padding:0px;color:rgb(51,51,51);border:1px solid rgb(204,204,204);overflow:auto;border-radius:3px;font-family:Arial,sans-serif;font-size:14px"><div class="m_264845914885871799gmail-codeHeader m_264845914885871799gmail-panelHeader m_264845914885871799gmail-pdl m_264845914885871799gmail-hide-border-bottom" style="margin:0px;padding:5px 15px;border-bottom:1px rgb(204,204,204);background:rgb(245,245,245);overflow:hidden"><b class="m_264845914885871799gmail-code-title" style="display:inline-block;padding-right:130px">Application Data Protocol from Client</b><br></div><div class="m_264845914885871799gmail-codeContent m_264845914885871799gmail-panelContent m_264845914885871799gmail-pdl m_264845914885871799gmail-hide-toolbar" style="margin:0px;padding:0px;background-image:initial;background-position:initial;background-size:initial;background-repeat:initial;background-origin:initial;background-clip:initial;line-height:20px;overflow:hidden;border-bottom-left-radius:3px;border-bottom-right-radius:3px"><div style="margin:0px;padding:0px"><div id="m_264845914885871799gmail-highlighter_424677" class="m_264845914885871799gmail-syntaxhighlighter m_264845914885871799gmail-collapsed m_264845914885871799gmail-java" style="padding:0px;width:1573px;margin:0px;overflow:visible;font-size:1em"></div></div></div></div></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra">Also, I observe that resumption connection time for TLS 1.3 using PSK  is more than resumption time for TLS 1.2 (by 700-800 microseconds). I am suspecting the exchange of application data and its processing etc (encryption) is causing the added delay. Could someone please provide any explanation or point me in the right direction. It is not very clear to me right now even after seeing the RFC</div><div class="gmail_extra"><br></div><div class="gmail_extra">Thanks</div><div><div class="h5"><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Jul 6, 2017 at 11:40 AM, Neetish Pathak <span dir="ltr"><<a href="mailto:npathak2@ncsu.edu" target="_blank">npathak2@ncsu.edu</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Thanks for the detailed explanation Matt</div><div class="m_264845914885871799gmail-HOEnZb"><div class="m_264845914885871799gmail-h5"><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Jul 4, 2017 at 1:51 AM, Matt Caswell <span dir="ltr"><<a href="mailto:matt@openssl.org" target="_blank">matt@openssl.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span><br>
<br>
On 03/07/17 22:24, Neetish Pathak wrote:<br>
<br>
> Thanks Matt. This is quite useful.<br>
> Just to clarify my understanding based on your comments, OpenSSL code<br>
>  and Draft for TLS 1.3/RFC for TLS1.2, please help me with following queries<br>
><br>
> 1) So, when using external PSK (by creating the new session file),<br>
> client should mandatorily use SSL_CTX_set_psk_use_session_ca<wbr>llback while<br>
</span>> server should mandatorily use SSL_CTX_set_psk_find_session_c<wbr>asllback.<br>
<span>> They both should use a common key (psk_key) to generate the new session<br>
> file and this common key is the one shared in advance to both client and<br>
> server.<br>
<br>
</span>Yes, that is correct. If both client and server are OpenSSL then,<br>
optionally, they can just share a session file (which contains the key)<br>
if that is easier.<br>
<span><br>
> From the OpenSSL code, this key is used as char * type. So does<br>
> it mean that any pre-decided string can be used as a key and it does not<br>
> need any format etc.<br>
<br>
</span>To me "string" implies NUL terminated printable string. Maybe that's not<br>
what you meant. Anyway in that sense "string" is not quite correct. The<br>
key is binary data which should be the same length as the hash used for<br>
the ciphersuite.<br>
<span><br>
<br>
> Both client and server create sessions based on the<br>
> key and connect based on the created session?<br>
</span>> In one of the examples, *strspn*(psk_key, "abcdefABCDEF1234567890") is<br>
<span>> used. So, I believe I can use any hex value string of my choice as psk_key.<br>
<br>
</span>Like I said above - the key is *binary* data. It does not have to be a<br>
printable string.<br>
<span><br>
<br>
> 2) Also, from the man page , I found that PSK are used in TLS1.2 and<br>
> lower versions too and SSL_CTX_set_psk_server_callbac<wbr>k<br>
> and SSL_CTX_set_psk_client_callbac<wbr>k are used to set callback there. PSK<br>
>  identity and Pre shared key is set there which can be used during the<br>
> connection. It is also written that these values are required when using<br>
> PSK cipher-suites. So, is my understanding correct that the role of PSK<br>
> in version <= TLS1.2 is only for using PSK ciphersuites<br>
> (e.g: ECDHE-PSK-AES256-CBC-SHA384)<br>
<br>
</span>Correct.<br>
<span><br>
> and do not have anything to do with<br>
> session resumption and thereby do not provide any performance enhancement.<br>
<br>
</span>They do not have anything to do with session resumption, so you don't<br>
see the reduced number of message flights that you get with a resumed<br>
handshake. However, PSK ciphersuites in <= TLS1.2 avoid the need to send<br>
(and therefore process/validate) Certificate messages which may have<br>
performance benefits. If the ciphersuite in use just uses "plain" PSK<br>
(i.e. no (EC)DHE or RSA) then a connection can be established without<br>
using public-key operations which may also have performance benefits (at<br>
the expense of forward secrecy).<br>
<span><br>
> Also, this PSK type ciphersuites are no longer valid for TLS 1.3.<br>
<br>
</span>Correct.<br>
<div class="m_264845914885871799gmail-m_-2335791293759539497HOEnZb"><div class="m_264845914885871799gmail-m_-2335791293759539497h5"><br>
<br>
Matt<br>
--<br>
openssl-users mailing list<br>
To unsubscribe: <a href="https://mta.openssl.org/mailman/listinfo/openssl-users" rel="noreferrer" target="_blank">https://mta.openssl.org/mailma<wbr>n/listinfo/openssl-users</a><br>
</div></div></blockquote></div><br></div>
</div></div></blockquote></div><br></div></div></div></div>
</div><br></div>