esp-nimble-cpp/class_nim_b_l_e_security.html
2022-07-31 11:38:16 -06:00

311 lines
15 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.9.1"/>
<meta name="viewport" content="width=device-width, initial-scale=1"/>
<title>esp-nimble-cpp: NimBLESecurity 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>
<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">esp-nimble-cpp
&#160;<span id="projectnumber">1.4.0</span>
</div>
</td>
</tr>
</tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<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','.html');
/* @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_nim_b_l_e_security.html',''); initResizable(); });
/* @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_nim_b_l_e_security-members.html">List of all members</a> </div>
<div class="headertitle">
<div class="title">NimBLESecurity Class Reference</div> </div>
</div><!--header-->
<div class="contents">
<p>A class to handle BLE security operations. <b>Deprecated - provided for backward compatibility only.</b>
<a href="class_nim_b_l_e_security.html#details">More...</a></p>
<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:a5cf0d3672a16f557032bcbf39a9e22f2"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_security.html#a5cf0d3672a16f557032bcbf39a9e22f2">setAuthenticationMode</a> (esp_ble_auth_req_t auth_req)</td></tr>
<tr class="memdesc:a5cf0d3672a16f557032bcbf39a9e22f2"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set requested authentication mode. <a href="class_nim_b_l_e_security.html#a5cf0d3672a16f557032bcbf39a9e22f2">More...</a><br /></td></tr>
<tr class="separator:a5cf0d3672a16f557032bcbf39a9e22f2"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a1bb7902d5ceffaca86bd7638a74e35e3"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_security.html#a1bb7902d5ceffaca86bd7638a74e35e3">setCapability</a> (esp_ble_io_cap_t iocap)</td></tr>
<tr class="memdesc:a1bb7902d5ceffaca86bd7638a74e35e3"><td class="mdescLeft">&#160;</td><td class="mdescRight">Set our device IO capability to let end user perform authorization either by displaying or entering generated 6-digit pin code or use "just works". <a href="class_nim_b_l_e_security.html#a1bb7902d5ceffaca86bd7638a74e35e3">More...</a><br /></td></tr>
<tr class="separator:a1bb7902d5ceffaca86bd7638a74e35e3"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:adfc3caa3e1a5aedc3be5c0f1dc5c99ac"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_security.html#adfc3caa3e1a5aedc3be5c0f1dc5c99ac">setInitEncryptionKey</a> (uint8_t init_key)</td></tr>
<tr class="memdesc:adfc3caa3e1a5aedc3be5c0f1dc5c99ac"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the keys we will distribute during encryption. <a href="class_nim_b_l_e_security.html#adfc3caa3e1a5aedc3be5c0f1dc5c99ac">More...</a><br /></td></tr>
<tr class="separator:adfc3caa3e1a5aedc3be5c0f1dc5c99ac"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:aac8434faa02a6813b7efd87224e04714"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_security.html#aac8434faa02a6813b7efd87224e04714">setRespEncryptionKey</a> (uint8_t resp_key)</td></tr>
<tr class="memdesc:aac8434faa02a6813b7efd87224e04714"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets the keys we will accept during encryption. <a href="class_nim_b_l_e_security.html#aac8434faa02a6813b7efd87224e04714">More...</a><br /></td></tr>
<tr class="separator:aac8434faa02a6813b7efd87224e04714"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:ab2be50284a325ec8937abdab0baafd4b"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_security.html#ab2be50284a325ec8937abdab0baafd4b">setKeySize</a> (uint8_t key_size=16)</td></tr>
<tr class="separator:ab2be50284a325ec8937abdab0baafd4b"><td class="memSeparator" colspan="2">&#160;</td></tr>
<tr class="memitem:a0bb1535e1b0d48566c17f681b7539f82"><td class="memItemLeft" align="right" valign="top">void&#160;</td><td class="memItemRight" valign="bottom"><a class="el" href="class_nim_b_l_e_security.html#a0bb1535e1b0d48566c17f681b7539f82">setStaticPIN</a> (uint32_t pin)</td></tr>
<tr class="memdesc:a0bb1535e1b0d48566c17f681b7539f82"><td class="mdescLeft">&#160;</td><td class="mdescRight">Sets a static PIN used to authenticate/encrypt the connection. <a href="class_nim_b_l_e_security.html#a0bb1535e1b0d48566c17f681b7539f82">More...</a><br /></td></tr>
<tr class="separator:a0bb1535e1b0d48566c17f681b7539f82"><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>A class to handle BLE security operations. <b>Deprecated - provided for backward compatibility only.</b> </p>
<dl class="deprecated"><dt><b><a class="el" href="deprecated.html#_deprecated000011">Deprecated:</a></b></dt><dd>Use the security methods provided in <a class="el" href="class_nim_b_l_e_device.html" title="A model of a BLE Device from which all the BLE roles are created.">NimBLEDevice</a> instead. </dd></dl>
</div><h2 class="groupheader">Member Function Documentation</h2>
<a id="a5cf0d3672a16f557032bcbf39a9e22f2"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a5cf0d3672a16f557032bcbf39a9e22f2">&#9670;&nbsp;</a></span>setAuthenticationMode()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void NimBLESecurity::setAuthenticationMode </td>
<td>(</td>
<td class="paramtype">esp_ble_auth_req_t&#160;</td>
<td class="paramname"><em>auth_req</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set requested authentication mode. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">auth_req</td><td>A bitmask containing one or more of:<ul>
<li>ESP_LE_AUTH_NO_BOND 0x00</li>
<li>ESP_LE_AUTH_BOND 0x01</li>
<li>ESP_LE_AUTH_REQ_MITM (1 &lt;&lt; 2)</li>
<li>ESP_LE_AUTH_REQ_BOND_MITM (ESP_LE_AUTH_BOND | ESP_LE_AUTH_REQ_MITM)</li>
<li>ESP_LE_AUTH_REQ_SC_ONLY (1 &lt;&lt; 3)</li>
<li>ESP_LE_AUTH_REQ_SC_BOND (ESP_LE_AUTH_BOND | ESP_LE_AUTH_REQ_SC_ONLY)</li>
<li>ESP_LE_AUTH_REQ_SC_MITM (ESP_LE_AUTH_REQ_MITM | ESP_LE_AUTH_REQ_SC_ONLY)</li>
<li>ESP_LE_AUTH_REQ_SC_MITM_BOND (ESP_LE_AUTH_REQ_MITM | ESP_LE_AUTH_REQ_SC_ONLY | ESP_LE_AUTH_BOND) </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a1bb7902d5ceffaca86bd7638a74e35e3"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a1bb7902d5ceffaca86bd7638a74e35e3">&#9670;&nbsp;</a></span>setCapability()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void NimBLESecurity::setCapability </td>
<td>(</td>
<td class="paramtype">esp_ble_io_cap_t&#160;</td>
<td class="paramname"><em>iocap</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Set our device IO capability to let end user perform authorization either by displaying or entering generated 6-digit pin code or use "just works". </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">iocap</td><td>The IO capabilites our device has.<br />
Can be set to one of:<ul>
<li>ESP_IO_CAP_OUT 0</li>
<li>ESP_IO_CAP_IO 1</li>
<li>ESP_IO_CAP_IN 2</li>
<li>ESP_IO_CAP_NONE 3</li>
<li>ESP_IO_CAP_KBDISP 4 </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="adfc3caa3e1a5aedc3be5c0f1dc5c99ac"></a>
<h2 class="memtitle"><span class="permalink"><a href="#adfc3caa3e1a5aedc3be5c0f1dc5c99ac">&#9670;&nbsp;</a></span>setInitEncryptionKey()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void NimBLESecurity::setInitEncryptionKey </td>
<td>(</td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>init_key</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets the keys we will distribute during encryption. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">init_key</td><td>A bitmask of the keys we will distribute.<br />
Can be one or more of:<ul>
<li>ESP_BLE_ENC_KEY_MASK (1 &lt;&lt; 0)</li>
<li>ESP_BLE_ID_KEY_MASK (1 &lt;&lt; 1)</li>
<li>ESP_BLE_CSR_KEY_MASK (1 &lt;&lt; 2)</li>
<li>ESP_BLE_LINK_KEY_MASK (1 &lt;&lt; 3) </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="ab2be50284a325ec8937abdab0baafd4b"></a>
<h2 class="memtitle"><span class="permalink"><a href="#ab2be50284a325ec8937abdab0baafd4b">&#9670;&nbsp;</a></span>setKeySize()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void NimBLESecurity::setKeySize </td>
<td>(</td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>key_size</em> = <code>16</code></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<dl class="todo"><dt><b><a class="el" href="todo.html#_todo000001">Todo:</a></b></dt><dd>Requires implementation </dd></dl>
</div>
</div>
<a id="aac8434faa02a6813b7efd87224e04714"></a>
<h2 class="memtitle"><span class="permalink"><a href="#aac8434faa02a6813b7efd87224e04714">&#9670;&nbsp;</a></span>setRespEncryptionKey()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void NimBLESecurity::setRespEncryptionKey </td>
<td>(</td>
<td class="paramtype">uint8_t&#160;</td>
<td class="paramname"><em>resp_key</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets the keys we will accept during encryption. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">resp_key</td><td>A bitmask of the keys we will accept.<br />
Can be one or more of:<ul>
<li>ESP_BLE_ENC_KEY_MASK (1 &lt;&lt; 0)</li>
<li>ESP_BLE_ID_KEY_MASK (1 &lt;&lt; 1)</li>
<li>ESP_BLE_CSR_KEY_MASK (1 &lt;&lt; 2)</li>
<li>ESP_BLE_LINK_KEY_MASK (1 &lt;&lt; 3) </li>
</ul>
</td></tr>
</table>
</dd>
</dl>
</div>
</div>
<a id="a0bb1535e1b0d48566c17f681b7539f82"></a>
<h2 class="memtitle"><span class="permalink"><a href="#a0bb1535e1b0d48566c17f681b7539f82">&#9670;&nbsp;</a></span>setStaticPIN()</h2>
<div class="memitem">
<div class="memproto">
<table class="memname">
<tr>
<td class="memname">void NimBLESecurity::setStaticPIN </td>
<td>(</td>
<td class="paramtype">uint32_t&#160;</td>
<td class="paramname"><em>pin</em></td><td>)</td>
<td></td>
</tr>
</table>
</div><div class="memdoc">
<p>Sets a static PIN used to authenticate/encrypt the connection. </p>
<dl class="params"><dt>Parameters</dt><dd>
<table class="params">
<tr><td class="paramdir">[in]</td><td class="paramname">pin</td><td>The 6 digit pin code to accept. </td></tr>
</table>
</dd>
</dl>
</div>
</div>
</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_nim_b_l_e_security.html">NimBLESecurity</a></li>
<li class="footer">Generated by <a href="https://www.doxygen.org/index.html"><img class="footer" src="doxygen.svg" width="104" height="31" alt="doxygen"/></a> 1.9.1 </li>
</ul>
</div>
</body>
</html>