SSLClient/docs/html/class_s_s_l_session.html
2019-03-31 15:52:50 -07:00

382 lines
20 KiB
HTML

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.8.15"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>SSLClient: SSLSession Class Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(initResizable);
/* @license-end */</script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
<tbody>
<tr style="height: 56px;">
<td id="projectalign" style="padding-left: 0.5em;">
<div id="projectname">SSLClient
&#160;<span id="projectnumber">1.0</span>
</div>
<div id="projectbrief">Add TLS 1.2 functionality to any network library.</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.8.15 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search');
/* @license-end */
</script>
<script type="text/javascript" src="menudata.js"></script>
<script type="text/javascript" src="menu.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(function() {
initMenu('',true,false,'search.php','Search');
$(document).ready(function() { init_search(); });
});
/* @license-end */</script>
<div id="main-nav"></div>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
<div id="nav-tree">
<div id="nav-tree-contents">
<div id="nav-sync" class="sync"></div>
</div>
</div>
<div id="splitbar" style="-moz-user-select:none;"
class="ui-resizable-handle">
</div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('class_s_s_l_session.html','');});
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
onmouseover="return searchBox.OnSearchSelectShow()"
onmouseout="return searchBox.OnSearchSelectHide()"
onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>
<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0"
name="MSearchResults" id="MSearchResults">
</iframe>
</div>
<div class="header">
<div class="summary">
<a href="#pub-methods">Public Member Functions</a> &#124;
<a href="class_s_s_l_session-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">SSLSession Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>This class stores values which allow <a class="el" href="class_s_s_l_client.html" title="The main SSLClient class Check out README.md for more info.">SSLClient</a> to save and resume SSL sessions.
<a href="class_s_s_l_session.html#details">More...</a></p>
<p><code>#include &lt;<a class="el" href="_s_s_l_session_8h_source.html">SSLSession.h</a>&gt;</code></p>
<div class="dynheader">
Inheritance diagram for SSLSession:</div>
<div class="dyncontent">
<div class="center">
<img src="class_s_s_l_session.png" alt=""/>
</div></div>
<table class="memberdecls">
<tr class="heading"><td colspan="2"><h2 class="groupheader"><a name="pub-methods"></a>
Public Member Functions</h2></td></tr>
<tr class="memitem:ae05648200cea66577f024d5d09a6fcbb"><td class="memItemLeft" align="right" valign="top">&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_s_s_l_session.html#ae05648200cea66577f024d5d09a6fcbb">SSLSession</a> ()</td></tr>
<tr class="memdesc:ae05648200cea66577f024d5d09a6fcbb"><td class="mdescLeft">&#160;</td><td class="mdescRight"><a class="el" href="class_s_s_l_session.html" title="This class stores values which allow SSLClient to save and resume SSL sessions.">SSLSession</a> constructor. <a href="#ae05648200cea66577f024d5d09a6fcbb">More...</a><br /></td></tr>
<tr class="separator:ae05648200cea66577f024d5d09a6fcbb"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:abb3f7bbe70e3a59f9ce492c55507f36f"><td class="memItemLeft" align="right" valign="top"><a class="el" href="class_s_s_l_session.html">SSLSession</a> &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_s_s_l_session.html#abb3f7bbe70e3a59f9ce492c55507f36f">operator=</a> (const <a class="el" href="class_s_s_l_session.html">SSLSession</a> &amp;)=delete</td></tr>
<tr class="memdesc:abb3f7bbe70e3a59f9ce492c55507f36f"><td class="mdescLeft">&#160;</td><td class="mdescRight">use clear_parameters or set_parameters instead <a href="#abb3f7bbe70e3a59f9ce492c55507f36f">More...</a><br /></td></tr>
<tr class="separator:abb3f7bbe70e3a59f9ce492c55507f36f"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a825373c5ba1aa6c45e74dc8a72b21820"><td class="memItemLeft" align="right" valign="top">const String &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_s_s_l_session.html#a825373c5ba1aa6c45e74dc8a72b21820">get_hostname</a> () const</td></tr>
<tr class="memdesc:a825373c5ba1aa6c45e74dc8a72b21820"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get the hostname string associated with this session. <a href="#a825373c5ba1aa6c45e74dc8a72b21820">More...</a><br /></td></tr>
<tr class="separator:a825373c5ba1aa6c45e74dc8a72b21820"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a878e1e8788634c5c42778369fbf7bab0"><td class="memItemLeft" align="right" valign="top">const IPAddress &amp;&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_s_s_l_session.html#a878e1e8788634c5c42778369fbf7bab0">get_ip</a> () const</td></tr>
<tr class="memdesc:a878e1e8788634c5c42778369fbf7bab0"><td class="mdescLeft">&#160;</td><td class="mdescRight">Get ::IPAddress associated with this session. <a href="#a878e1e8788634c5c42778369fbf7bab0">More...</a><br /></td></tr>
<tr class="separator:a878e1e8788634c5c42778369fbf7bab0"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0c36cee72cfa862b7d4b2f5c112d5076"><td class="memItemLeft" align="right" valign="top">bool&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_s_s_l_session.html#a0c36cee72cfa862b7d4b2f5c112d5076">is_valid_session</a> () const</td></tr>
<tr class="separator:a0c36cee72cfa862b7d4b2f5c112d5076"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a2fa15ce0b7caae25dfb567954175257e"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_s_s_l_session.html#a2fa15ce0b7caae25dfb567954175257e">set_parameters</a> (const IPAddress &amp;ip, const char *hostname=NULL)</td></tr>
<tr class="memdesc:a2fa15ce0b7caae25dfb567954175257e"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set the ip address and hostname of the session. <a href="#a2fa15ce0b7caae25dfb567954175257e">More...</a><br /></td></tr>
<tr class="separator:a2fa15ce0b7caae25dfb567954175257e"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a3305941fa615f7134526b718917716ee"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_s_s_l_session.html#a3305941fa615f7134526b718917716ee">clear_parameters</a> ()</td></tr>
<tr class="memdesc:a3305941fa615f7134526b718917716ee"><td class="mdescLeft">&#160;</td><td class="mdescRight">delete the parameters and invalidate the session Roughly equivalent to this_session = <a class="el" href="class_s_s_l_session.html#ae05648200cea66577f024d5d09a6fcbb" title="SSLSession constructor.">SSLSession()</a>, however this function preserves the String object, allowing it to better handle the dynamic memory needed. <a href="#a3305941fa615f7134526b718917716ee">More...</a><br /></td></tr>
<tr class="separator:a3305941fa615f7134526b718917716ee"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:acbe6549b55d50541d09a16f770e65afc"><td class="memItemLeft" align="right" valign="top">br_ssl_session_parameters *&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_s_s_l_session.html#acbe6549b55d50541d09a16f770e65afc">to_br_session</a> ()</td></tr>
<tr class="memdesc:acbe6549b55d50541d09a16f770e65afc"><td class="mdescLeft">&#160;</td><td class="mdescRight">returns a pointer to the ::br_ssl_session_parameters component of this class <a href="#acbe6549b55d50541d09a16f770e65afc">More...</a><br /></td></tr>
<tr class="separator:acbe6549b55d50541d09a16f770e65afc"><td class="memSeparator" colspan="2">&#160;</td></tr>
</table>
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
<div class="textblock"><p>This class stores values which allow <a class="el" href="class_s_s_l_client.html" title="The main SSLClient class Check out README.md for more info.">SSLClient</a> to save and resume SSL sessions. </p>
<p><a class="el" href="_s_s_l_session_8h.html">SSLSession.h</a></p>
<p>This file contains a simple utility class to store parameters about an SSL Session for reuse later.This class was created to extend the values stored in br_ssl_session_parameters, which allow BearSSL to resume an SSL session. When testing BearSSL's session resumption feature, it was observed that BearSSL can only resume a session that was was started with the same server. This becomes an issue when using repeated requests to a domain name which can resolve to multiple IP addresses ("api.github.com"), as the device will switch between two or three servers. Since BearSSL only stores one session at a time, this results in session resumption being few and far between.</p>
<p>To remedy this problem, an <a class="el" href="class_s_s_l_session.html" title="This class stores values which allow SSLClient to save and resume SSL sessions.">SSLSession</a> stores the IPAddress and hostname, along with the parameters in br_ssl_session_parameters struct. Using this data, <a class="el" href="class_s_s_l_client.html" title="The main SSLClient class Check out README.md for more info.">SSLClient</a> is able to remember which IPAddress is associated with which session, allowing it to reconnect to the last IPAddress, as opposed to any associated with the domain. </p>
</div><h2 class="groupheader">Constructor &amp; Destructor Documentation</h2>
<a id="ae05648200cea66577f024d5d09a6fcbb"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ae05648200cea66577f024d5d09a6fcbb">&#9670;&nbsp;</a></span>SSLSession()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">SSLSession::SSLSession </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span><span class="mlabel">explicit</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p><a class="el" href="class_s_s_l_session.html" title="This class stores values which allow SSLClient to save and resume SSL sessions.">SSLSession</a> constructor. </p>
<p>Sets all parameters to zero, and invalidates the session </p>
</div>
</div>
<h2 class="groupheader">Member Function Documentation</h2>
<a id="a3305941fa615f7134526b718917716ee"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a3305941fa615f7134526b718917716ee">&#9670;&nbsp;</a></span>clear_parameters()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void SSLSession::clear_parameters </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>delete the parameters and invalidate the session Roughly equivalent to this_session = <a class="el" href="class_s_s_l_session.html#ae05648200cea66577f024d5d09a6fcbb" title="SSLSession constructor.">SSLSession()</a>, however this function preserves the String object, allowing it to better handle the dynamic memory needed. </p>
</div>
</div>
<a id="a825373c5ba1aa6c45e74dc8a72b21820"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a825373c5ba1aa6c45e74dc8a72b21820">&#9670;&nbsp;</a></span>get_hostname()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const String&amp; SSLSession::get_hostname </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Get the hostname string associated with this session. </p>
<dl class="section return"><dt>Returns</dt><dd>A String object or "" if there is no hostname </dd></dl>
<dl class="section pre"><dt>Precondition</dt><dd>must check isValidSession before getting this value, as if this session in invalid this value is not guarented to be reset to "". </dd></dl>
</div>
</div>
<a id="a878e1e8788634c5c42778369fbf7bab0"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a878e1e8788634c5c42778369fbf7bab0">&#9670;&nbsp;</a></span>get_ip()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">const IPAddress&amp; SSLSession::get_ip </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>Get ::IPAddress associated with this session. </p>
<dl class="section return"><dt>Returns</dt><dd>A ::IPAddress object, #INADDR_NONE if there is no IP </dd></dl>
<dl class="section pre"><dt>Precondition</dt><dd>must check isValidSession before getting this value, as if this session in invalid this value is not guarented to be reset to #INADDR_NONE. </dd></dl>
</div>
</div>
<a id="a0c36cee72cfa862b7d4b2f5c112d5076"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0c36cee72cfa862b7d4b2f5c112d5076">&#9670;&nbsp;</a></span>is_valid_session()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">bool SSLSession::is_valid_session </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td> const</td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
</div>
</div>
<a id="abb3f7bbe70e3a59f9ce492c55507f36f"></a>
<h2 class="memtitle"><span class="permalink"><a href="#abb3f7bbe70e3a59f9ce492c55507f36f">&#9670;&nbsp;</a></span>operator=()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname"><a class="el" href="class_s_s_l_session.html">SSLSession</a>&amp; SSLSession::operator= </td>
<td>(</td>
<td class="paramtype">const <a class="el" href="class_s_s_l_session.html">SSLSession</a> &amp;&#160;</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">delete</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>use clear_parameters or set_parameters instead </p>
</div>
</div>
<a id="a2fa15ce0b7caae25dfb567954175257e"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a2fa15ce0b7caae25dfb567954175257e">&#9670;&nbsp;</a></span>set_parameters()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void SSLSession::set_parameters </td>
<td>(</td>
<td class="paramtype">const IPAddress &amp;&#160;</td>
<td class="paramname"><em>ip</em>, </td>
</tr>
<tr>
<td class="paramkey"></td>
<td></td>
<td class="paramtype">const char *&#160;</td>
<td class="paramname"><em>hostname</em> = <code>NULL</code>&#160;</td>
</tr>
<tr>
<td></td>
<td>)</td>
<td></td><td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set the ip address and hostname of the session. </p>
<p>This function stores the ip Address object and hostname object into the session object. If hostname is not null or ip address is not blank, and the ::br_ssl_session_parameters values are non-zero it then validates the session.</p>
<dl class="section pre"><dt>Precondition</dt><dd>You must call ::br_ssl_engine_get_session_parameters with this session before calling this function. This is because there is no way to completly validate the ::br_ssl_session_parameters and the session may end up in a corrupted state if this is not observed.</dd></dl>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramname">ip</td><td>The IP address of the host associated with the session </td></tr>
<tr><td class="paramname">hostname</td><td>The string hostname ("www.google.com") associated with the session. Take care that this value is corrent, <a class="el" href="class_s_s_l_session.html" title="This class stores values which allow SSLClient to save and resume SSL sessions.">SSLSession</a> performs no validation of the hostname. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="acbe6549b55d50541d09a16f770e65afc"></a>
<h2 class="memtitle"><span class="permalink"><a href="#acbe6549b55d50541d09a16f770e65afc">&#9670;&nbsp;</a></span>to_br_session()</h2>
<div class="memitem">
<div class="memproto">
<table class="mlabels">
<tr>
<td class="mlabels-left">
<table class="memname">
<tr>
<td class="memname">br_ssl_session_parameters* SSLSession::to_br_session </td>
<td>(</td>
<td class="paramname"></td><td>)</td>
<td></td>
</tr>
</table>
</td>
<td class="mlabels-right">
<span class="mlabels"><span class="mlabel">inline</span></span> </td>
</tr>
</table>
</div><div class="memdoc">
<p>returns a pointer to the ::br_ssl_session_parameters component of this class </p>
</div>
</div>
<hr/>The documentation for this class was generated from the following files:<ul>
<li>C:/Users/Noah/Documents/Arduino/libraries/SSLClient/src/<a class="el" href="_s_s_l_session_8h_source.html">SSLSession.h</a></li>
<li>C:/Users/Noah/Documents/Arduino/libraries/SSLClient/src/<a class="el" href="_s_s_l_session_8cpp.html">SSLSession.cpp</a></li>
</ul>
</div><!-- contents -->
</div><!-- doc-content -->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
<ul>
<li class="navelem"><a class="el" href="class_s_s_l_session.html">SSLSession</a></li>
<li class="footer">Generated by
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.8.15 </li>
</ul>
</div>
</body>
</html>