mirror of
https://github.com/taigrr/arduinolibs
synced 2025-01-18 04:33:12 -08:00
361 lines
30 KiB
HTML
361 lines
30 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://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.6"/>
|
|
<title>Arduino Cryptography Library: AuthenticatedCipher 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="search/search.css" rel="stylesheet" type="text/css"/>
|
|
<script type="text/javascript" src="search/search.js"></script>
|
|
<script type="text/javascript">
|
|
$(document).ready(function() { searchBox.OnSelectItem(0); });
|
|
</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 style="padding-left: 0.5em;">
|
|
<div id="projectname">Arduino Cryptography Library
|
|
</div>
|
|
</td>
|
|
</tr>
|
|
</tbody>
|
|
</table>
|
|
</div>
|
|
<!-- end header part -->
|
|
<!-- Generated by Doxygen 1.8.6 -->
|
|
<script type="text/javascript">
|
|
var searchBox = new SearchBox("searchBox", "search",false,'Search');
|
|
</script>
|
|
<div id="navrow1" class="tabs">
|
|
<ul class="tablist">
|
|
<li><a href="index.html"><span>Main Page</span></a></li>
|
|
<li><a href="pages.html"><span>Related Pages</span></a></li>
|
|
<li class="current"><a href="annotated.html"><span>Classes</span></a></li>
|
|
<li><a href="files.html"><span>Files</span></a></li>
|
|
<li>
|
|
<div id="MSearchBox" class="MSearchBoxInactive">
|
|
<span class="left">
|
|
<img id="MSearchSelect" src="search/mag_sel.png"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
alt=""/>
|
|
<input type="text" id="MSearchField" value="Search" accesskey="S"
|
|
onfocus="searchBox.OnSearchFieldFocus(true)"
|
|
onblur="searchBox.OnSearchFieldFocus(false)"
|
|
onkeyup="searchBox.OnSearchFieldChange(event)"/>
|
|
</span><span class="right">
|
|
<a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.png" alt=""/></a>
|
|
</span>
|
|
</div>
|
|
</li>
|
|
</ul>
|
|
</div>
|
|
<div id="navrow2" class="tabs2">
|
|
<ul class="tablist">
|
|
<li><a href="annotated.html"><span>Class List</span></a></li>
|
|
<li><a href="classes.html"><span>Class Index</span></a></li>
|
|
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
|
|
<li><a href="functions.html"><span>Class Members</span></a></li>
|
|
</ul>
|
|
</div>
|
|
<!-- window showing the filter options -->
|
|
<div id="MSearchSelectWindow"
|
|
onmouseover="return searchBox.OnSearchSelectShow()"
|
|
onmouseout="return searchBox.OnSearchSelectHide()"
|
|
onkeydown="return searchBox.OnSearchSelectKey(event)">
|
|
<a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(0)"><span class="SelectionMark"> </span>All</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(1)"><span class="SelectionMark"> </span>Classes</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(2)"><span class="SelectionMark"> </span>Files</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(3)"><span class="SelectionMark"> </span>Functions</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(4)"><span class="SelectionMark"> </span>Variables</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(5)"><span class="SelectionMark"> </span>Enumerations</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(6)"><span class="SelectionMark"> </span>Enumerator</a><a class="SelectItem" href="javascript:void(0)" onclick="searchBox.OnSelectItem(7)"><span class="SelectionMark"> </span>Pages</a></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><!-- top -->
|
|
<div class="header">
|
|
<div class="summary">
|
|
<a href="#pub-methods">Public Member Functions</a> |
|
|
<a href="classAuthenticatedCipher-members.html">List of all members</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">AuthenticatedCipher Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p>Abstract base class for authenticated ciphers.
|
|
<a href="classAuthenticatedCipher.html#details">More...</a></p>
|
|
|
|
<p><code>#include <<a class="el" href="AuthenticatedCipher_8h_source.html">AuthenticatedCipher.h</a>></code></p>
|
|
<div class="dynheader">
|
|
Inheritance diagram for AuthenticatedCipher:</div>
|
|
<div class="dyncontent">
|
|
<div class="center">
|
|
<img src="classAuthenticatedCipher.png" usemap="#AuthenticatedCipher_map" alt=""/>
|
|
<map id="AuthenticatedCipher_map" name="AuthenticatedCipher_map">
|
|
<area href="classCipher.html" title="Abstract base class for stream ciphers. " alt="Cipher" shape="rect" coords="274,0,401,24"/>
|
|
<area href="classAcorn128.html" title="ACORN-128 authenticated cipher. " alt="Acorn128" shape="rect" coords="0,112,127,136"/>
|
|
<area href="classAscon128.html" title="ASCON-128 authenticated cipher. " alt="Ascon128" shape="rect" coords="137,112,264,136"/>
|
|
<area href="classChaChaPoly.html" title="Authenticated cipher based on ChaCha and Poly1305. " alt="ChaChaPoly" shape="rect" coords="274,112,401,136"/>
|
|
<area href="classEAXCommon.html" title="Concrete base class to assist with implementing EAX for 128-bit block ciphers. " alt="EAXCommon" shape="rect" coords="411,112,538,136"/>
|
|
<area href="classGCMCommon.html" title="Concrete base class to assist with implementing GCM for 128-bit block ciphers. " alt="GCMCommon" shape="rect" coords="548,112,675,136"/>
|
|
<area href="classEAX.html" title="Implementation of the EAX authenticated cipher. " alt="EAX< T >" shape="rect" coords="411,168,538,192"/>
|
|
<area href="classGCM.html" title="Implementation of the Galois Counter Mode (GCM). " alt="GCM< T >" shape="rect" coords="548,168,675,192"/>
|
|
</map>
|
|
</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:a0b1c0210ecb9d374d09b5b62a5140ba2"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a0b1c0210ecb9d374d09b5b62a5140ba2"></a>
|
|
 </td><td class="memItemRight" valign="bottom"><a class="el" href="classAuthenticatedCipher.html#a0b1c0210ecb9d374d09b5b62a5140ba2">AuthenticatedCipher</a> ()</td></tr>
|
|
<tr class="memdesc:a0b1c0210ecb9d374d09b5b62a5140ba2"><td class="mdescLeft"> </td><td class="mdescRight">Constructs a new authenticated cipher. <br/></td></tr>
|
|
<tr class="separator:a0b1c0210ecb9d374d09b5b62a5140ba2"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ae52a07be5b7265ea5898529ec21a79e4"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="ae52a07be5b7265ea5898529ec21a79e4"></a>
|
|
virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classAuthenticatedCipher.html#ae52a07be5b7265ea5898529ec21a79e4">~AuthenticatedCipher</a> ()</td></tr>
|
|
<tr class="memdesc:ae52a07be5b7265ea5898529ec21a79e4"><td class="mdescLeft"> </td><td class="mdescRight">Destroys this authenticated cipher. <br/></td></tr>
|
|
<tr class="separator:ae52a07be5b7265ea5898529ec21a79e4"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a50c9de15b1ac1f3079dcfef626238759"><td class="memItemLeft" align="right" valign="top">virtual size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classAuthenticatedCipher.html#a50c9de15b1ac1f3079dcfef626238759">tagSize</a> () const =0</td></tr>
|
|
<tr class="memdesc:a50c9de15b1ac1f3079dcfef626238759"><td class="mdescLeft"> </td><td class="mdescRight">Returns the size of the authentication tag. <a href="#a50c9de15b1ac1f3079dcfef626238759">More...</a><br/></td></tr>
|
|
<tr class="separator:a50c9de15b1ac1f3079dcfef626238759"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:abdb081bdf0d59c138cbcffd23c044b10"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAuthenticatedCipher.html#abdb081bdf0d59c138cbcffd23c044b10">addAuthData</a> (const void *data, size_t len)=0</td></tr>
|
|
<tr class="memdesc:abdb081bdf0d59c138cbcffd23c044b10"><td class="mdescLeft"> </td><td class="mdescRight">Adds extra data that will be authenticated but not encrypted. <a href="#abdb081bdf0d59c138cbcffd23c044b10">More...</a><br/></td></tr>
|
|
<tr class="separator:abdb081bdf0d59c138cbcffd23c044b10"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a73fa4306053ed457e5c533b3127391c9"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classAuthenticatedCipher.html#a73fa4306053ed457e5c533b3127391c9">computeTag</a> (void *tag, size_t len)=0</td></tr>
|
|
<tr class="memdesc:a73fa4306053ed457e5c533b3127391c9"><td class="mdescLeft"> </td><td class="mdescRight">Finalizes the encryption process and computes the authentication tag. <a href="#a73fa4306053ed457e5c533b3127391c9">More...</a><br/></td></tr>
|
|
<tr class="separator:a73fa4306053ed457e5c533b3127391c9"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a4bb33d194e2c7d30c4e5a713e59786ff"><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classAuthenticatedCipher.html#a4bb33d194e2c7d30c4e5a713e59786ff">checkTag</a> (const void *tag, size_t len)=0</td></tr>
|
|
<tr class="memdesc:a4bb33d194e2c7d30c4e5a713e59786ff"><td class="mdescLeft"> </td><td class="mdescRight">Finalizes the decryption process and checks the authentication tag. <a href="#a4bb33d194e2c7d30c4e5a713e59786ff">More...</a><br/></td></tr>
|
|
<tr class="separator:a4bb33d194e2c7d30c4e5a713e59786ff"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="inherit_header pub_methods_classCipher"><td colspan="2" onclick="javascript:toggleInherit('pub_methods_classCipher')"><img src="closed.png" alt="-"/> Public Member Functions inherited from <a class="el" href="classCipher.html">Cipher</a></td></tr>
|
|
<tr class="memitem:a6a61077eca3ccd5900f92ceac58fb09c inherit pub_methods_classCipher"><td class="memItemLeft" align="right" valign="top"><a class="anchor" id="a6a61077eca3ccd5900f92ceac58fb09c"></a>
|
|
 </td><td class="memItemRight" valign="bottom"><a class="el" href="classCipher.html#a6a61077eca3ccd5900f92ceac58fb09c">Cipher</a> ()</td></tr>
|
|
<tr class="memdesc:a6a61077eca3ccd5900f92ceac58fb09c inherit pub_methods_classCipher"><td class="mdescLeft"> </td><td class="mdescRight">Constructs a new cipher object. <br/></td></tr>
|
|
<tr class="separator:a6a61077eca3ccd5900f92ceac58fb09c inherit pub_methods_classCipher"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a84bdea765f7e35aa5b5950dd2853a383 inherit pub_methods_classCipher"><td class="memItemLeft" align="right" valign="top">virtual </td><td class="memItemRight" valign="bottom"><a class="el" href="classCipher.html#a84bdea765f7e35aa5b5950dd2853a383">~Cipher</a> ()</td></tr>
|
|
<tr class="memdesc:a84bdea765f7e35aa5b5950dd2853a383 inherit pub_methods_classCipher"><td class="mdescLeft"> </td><td class="mdescRight">Destroys this cipher object. <a href="#a84bdea765f7e35aa5b5950dd2853a383">More...</a><br/></td></tr>
|
|
<tr class="separator:a84bdea765f7e35aa5b5950dd2853a383 inherit pub_methods_classCipher"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a4cea432ea0278c865441f17cbb88b1ab inherit pub_methods_classCipher"><td class="memItemLeft" align="right" valign="top">virtual size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classCipher.html#a4cea432ea0278c865441f17cbb88b1ab">keySize</a> () const =0</td></tr>
|
|
<tr class="memdesc:a4cea432ea0278c865441f17cbb88b1ab inherit pub_methods_classCipher"><td class="mdescLeft"> </td><td class="mdescRight">Default size of the key for this cipher, in bytes. <a href="#a4cea432ea0278c865441f17cbb88b1ab">More...</a><br/></td></tr>
|
|
<tr class="separator:a4cea432ea0278c865441f17cbb88b1ab inherit pub_methods_classCipher"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ab8b53ddc4ce431f03c2a1903d70ace9c inherit pub_methods_classCipher"><td class="memItemLeft" align="right" valign="top">virtual size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="classCipher.html#ab8b53ddc4ce431f03c2a1903d70ace9c">ivSize</a> () const =0</td></tr>
|
|
<tr class="memdesc:ab8b53ddc4ce431f03c2a1903d70ace9c inherit pub_methods_classCipher"><td class="mdescLeft"> </td><td class="mdescRight">Size of the initialization vector for this cipher, in bytes. <a href="#ab8b53ddc4ce431f03c2a1903d70ace9c">More...</a><br/></td></tr>
|
|
<tr class="separator:ab8b53ddc4ce431f03c2a1903d70ace9c inherit pub_methods_classCipher"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a0dfe133bda81dfa680b668f5908ccbe5 inherit pub_methods_classCipher"><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classCipher.html#a0dfe133bda81dfa680b668f5908ccbe5">setKey</a> (const uint8_t *key, size_t len)=0</td></tr>
|
|
<tr class="memdesc:a0dfe133bda81dfa680b668f5908ccbe5 inherit pub_methods_classCipher"><td class="mdescLeft"> </td><td class="mdescRight">Sets the key to use for future encryption and decryption operations. <a href="#a0dfe133bda81dfa680b668f5908ccbe5">More...</a><br/></td></tr>
|
|
<tr class="separator:a0dfe133bda81dfa680b668f5908ccbe5 inherit pub_methods_classCipher"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a3777acd8ff776a4e945bb7c9f2d044d9 inherit pub_methods_classCipher"><td class="memItemLeft" align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classCipher.html#a3777acd8ff776a4e945bb7c9f2d044d9">setIV</a> (const uint8_t *iv, size_t len)=0</td></tr>
|
|
<tr class="memdesc:a3777acd8ff776a4e945bb7c9f2d044d9 inherit pub_methods_classCipher"><td class="mdescLeft"> </td><td class="mdescRight">Sets the initialization vector to use for future encryption and decryption operations. <a href="#a3777acd8ff776a4e945bb7c9f2d044d9">More...</a><br/></td></tr>
|
|
<tr class="separator:a3777acd8ff776a4e945bb7c9f2d044d9 inherit pub_methods_classCipher"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ad2832bd61039d61560e34ea3382ca562 inherit pub_methods_classCipher"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCipher.html#ad2832bd61039d61560e34ea3382ca562">encrypt</a> (uint8_t *output, const uint8_t *input, size_t len)=0</td></tr>
|
|
<tr class="memdesc:ad2832bd61039d61560e34ea3382ca562 inherit pub_methods_classCipher"><td class="mdescLeft"> </td><td class="mdescRight">Encrypts an input buffer and writes the ciphertext to an output buffer. <a href="#ad2832bd61039d61560e34ea3382ca562">More...</a><br/></td></tr>
|
|
<tr class="separator:ad2832bd61039d61560e34ea3382ca562 inherit pub_methods_classCipher"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ac6099d1a0d7f2ff67b0e4ccb4a17eb08 inherit pub_methods_classCipher"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCipher.html#ac6099d1a0d7f2ff67b0e4ccb4a17eb08">decrypt</a> (uint8_t *output, const uint8_t *input, size_t len)=0</td></tr>
|
|
<tr class="memdesc:ac6099d1a0d7f2ff67b0e4ccb4a17eb08 inherit pub_methods_classCipher"><td class="mdescLeft"> </td><td class="mdescRight">Decrypts an input buffer and writes the plaintext to an output buffer. <a href="#ac6099d1a0d7f2ff67b0e4ccb4a17eb08">More...</a><br/></td></tr>
|
|
<tr class="separator:ac6099d1a0d7f2ff67b0e4ccb4a17eb08 inherit pub_methods_classCipher"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a4b7c3965646441a70d9ab934a7c92ab1 inherit pub_methods_classCipher"><td class="memItemLeft" align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classCipher.html#a4b7c3965646441a70d9ab934a7c92ab1">clear</a> ()=0</td></tr>
|
|
<tr class="memdesc:a4b7c3965646441a70d9ab934a7c92ab1 inherit pub_methods_classCipher"><td class="mdescLeft"> </td><td class="mdescRight">Clears all security-sensitive state from this cipher. <a href="#a4b7c3965646441a70d9ab934a7c92ab1">More...</a><br/></td></tr>
|
|
<tr class="separator:a4b7c3965646441a70d9ab934a7c92ab1 inherit pub_methods_classCipher"><td class="memSeparator" colspan="2"> </td></tr>
|
|
</table>
|
|
<a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
|
|
<div class="textblock"><p>Abstract base class for authenticated ciphers. </p>
|
|
<p>This class abstracts the details of algorithms that provide Authenticated Encryption with Associated Data (AEAD). Such algorithms combine encryption with message authentication to provide a single primitive.</p>
|
|
<p>Authenticated ciphers have four parameters: the secret key, an initialization vector (called a "nonce" in the literature), the plaintext, and some associated data which is to be authenticated with the plaintext but not encrypted. Associated data might be sequence numbers, IP addresses, protocol versions, or other information that is not secret but is important and unique to the session.</p>
|
|
<p>Subclasses encrypt the plaintext content and output the ciphertext. Once all plaintext has been processed, the caller should invoke <a class="el" href="classAuthenticatedCipher.html#a73fa4306053ed457e5c533b3127391c9" title="Finalizes the encryption process and computes the authentication tag. ">computeTag()</a> to obtain the authentication tag to transmit with the ciphertext. When the ciphertext is later decrypted, the <a class="el" href="classAuthenticatedCipher.html#a4bb33d194e2c7d30c4e5a713e59786ff" title="Finalizes the decryption process and checks the authentication tag. ">checkTag()</a> function can be used to check that the data is authentic.</p>
|
|
<p>Reference: <a href="http://tools.ietf.org/html/rfc5116">RFC 5116</a></p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classCipher.html" title="Abstract base class for stream ciphers. ">Cipher</a> </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="AuthenticatedCipher_8h_source.html#l00028">28</a> of file <a class="el" href="AuthenticatedCipher_8h_source.html">AuthenticatedCipher.h</a>.</p>
|
|
</div><h2 class="groupheader">Member Function Documentation</h2>
|
|
<a class="anchor" id="abdb081bdf0d59c138cbcffd23c044b10"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void AuthenticatedCipher::addAuthData </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const void * </td>
|
|
<td class="paramname"><em>data</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>len</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Adds extra data that will be authenticated but not encrypted. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">data</td><td>The extra data to be authenticated. </td></tr>
|
|
<tr><td class="paramname">len</td><td>The number of bytes of extra data to be authenticated.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<p>This function must be called before the first call to <a class="el" href="classCipher.html#ad2832bd61039d61560e34ea3382ca562" title="Encrypts an input buffer and writes the ciphertext to an output buffer. ">encrypt()</a> or <a class="el" href="classCipher.html#ac6099d1a0d7f2ff67b0e4ccb4a17eb08" title="Decrypts an input buffer and writes the plaintext to an output buffer. ">decrypt()</a>. That is, it is assumed that all extra data for authentication is available before the first payload data block and that it will be prepended to the payload for authentication. If the subclass needs to process the extra data after the payload, then it is responsible for saving <em>data</em> away until it is needed during <a class="el" href="classAuthenticatedCipher.html#a73fa4306053ed457e5c533b3127391c9" title="Finalizes the encryption process and computes the authentication tag. ">computeTag()</a> or <a class="el" href="classAuthenticatedCipher.html#a4bb33d194e2c7d30c4e5a713e59786ff" title="Finalizes the decryption process and checks the authentication tag. ">checkTag()</a>.</p>
|
|
<p>This function can be called multiple times with separate extra data blocks for authentication. All such data will be concatenated into a single block for authentication purposes. </p>
|
|
|
|
<p>Implemented in <a class="el" href="classAcorn128.html#a9a893539010c729c7d93a7acfd76ae67">Acorn128</a>, <a class="el" href="classChaChaPoly.html#a4aa3514d1fb6272da977a7467ae6734b">ChaChaPoly</a>, <a class="el" href="classEAXCommon.html#acdf2c51fb11c068202311b5c95767db8">EAXCommon</a>, <a class="el" href="classGCMCommon.html#ad926e980ae2d61c10c9bf82813154a25">GCMCommon</a>, and <a class="el" href="classAscon128.html#aa8377235ad18215ac8a38e2638b52aa3">Ascon128</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a4bb33d194e2c7d30c4e5a713e59786ff"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">bool AuthenticatedCipher::checkTag </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const void * </td>
|
|
<td class="paramname"><em>tag</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>len</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Finalizes the decryption process and checks the authentication tag. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">tag</td><td>The tag value from the incoming ciphertext to be checked. </td></tr>
|
|
<tr><td class="paramname">len</td><td>The length of the tag value in bytes, which may be less than <a class="el" href="classAuthenticatedCipher.html#a50c9de15b1ac1f3079dcfef626238759" title="Returns the size of the authentication tag. ">tagSize()</a>.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>Returns true if the <em>tag</em> is identical to the first <em>len</em> bytes of the authentication tag that was calculated during the decryption process. Returns false otherwise.</dd></dl>
|
|
<p>This function must be called after the final block of ciphertext is passed to <a class="el" href="classCipher.html#ac6099d1a0d7f2ff67b0e4ccb4a17eb08" title="Decrypts an input buffer and writes the plaintext to an output buffer. ">decrypt()</a> to determine if the data could be authenticated.</p>
|
|
<dl class="section note"><dt>Note</dt><dd>Authenticated cipher modes usually require that if the tag could not be verified, then all of the data that was previously decrypted <em>must</em> be discarded. It is unwise to use the decrypted data for any purpose before it can be verified. Callers are responsible for ensuring that any data returned via previous calls to <a class="el" href="classCipher.html#ac6099d1a0d7f2ff67b0e4ccb4a17eb08" title="Decrypts an input buffer and writes the plaintext to an output buffer. ">decrypt()</a> is discarded if <a class="el" href="classAuthenticatedCipher.html#a4bb33d194e2c7d30c4e5a713e59786ff" title="Finalizes the decryption process and checks the authentication tag. ">checkTag()</a> returns false.</dd></dl>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classAuthenticatedCipher.html#a73fa4306053ed457e5c533b3127391c9" title="Finalizes the encryption process and computes the authentication tag. ">computeTag()</a> </dd></dl>
|
|
|
|
<p>Implemented in <a class="el" href="classAcorn128.html#a0a1c914c76d15af00bbb348f160bbacb">Acorn128</a>, <a class="el" href="classChaChaPoly.html#aeffb3e0df0b4da03f72f30251243d953">ChaChaPoly</a>, <a class="el" href="classEAXCommon.html#a72c403f52cefab57566bc5f634c1b963">EAXCommon</a>, <a class="el" href="classGCMCommon.html#a70229be2fe2274c4109fe7511481075a">GCMCommon</a>, and <a class="el" href="classAscon128.html#a877fd3bf568963d1712479a747ff619e">Ascon128</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a73fa4306053ed457e5c533b3127391c9"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void AuthenticatedCipher::computeTag </td>
|
|
<td>(</td>
|
|
<td class="paramtype">void * </td>
|
|
<td class="paramname"><em>tag</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">size_t </td>
|
|
<td class="paramname"><em>len</em> </td>
|
|
</tr>
|
|
<tr>
|
|
<td></td>
|
|
<td>)</td>
|
|
<td></td><td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">pure virtual</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Finalizes the encryption process and computes the authentication tag. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">tag</td><td>Points to the buffer to write the tag to. </td></tr>
|
|
<tr><td class="paramname">len</td><td>The length of the tag, which may be less than <a class="el" href="classAuthenticatedCipher.html#a50c9de15b1ac1f3079dcfef626238759" title="Returns the size of the authentication tag. ">tagSize()</a> to truncate the tag to the first <em>len</em> bytes.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classAuthenticatedCipher.html#a4bb33d194e2c7d30c4e5a713e59786ff" title="Finalizes the decryption process and checks the authentication tag. ">checkTag()</a> </dd></dl>
|
|
|
|
<p>Implemented in <a class="el" href="classAcorn128.html#a333c98509f0ba55dff684d54781c0242">Acorn128</a>, <a class="el" href="classChaChaPoly.html#a92d850ad7027829e4072c43bd5028f95">ChaChaPoly</a>, <a class="el" href="classEAXCommon.html#ab5a61bba48561d6e7e6b8bafc51d91e3">EAXCommon</a>, <a class="el" href="classGCMCommon.html#a444634bd4469bb5d404ac882d1d8fdf4">GCMCommon</a>, and <a class="el" href="classAscon128.html#aca6f3d22d2beda9abc0a7ee1a4fb1ee6">Ascon128</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a50c9de15b1ac1f3079dcfef626238759"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t AuthenticatedCipher::tagSize </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">pure virtual</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Returns the size of the authentication tag. </p>
|
|
<dl class="section return"><dt>Returns</dt><dd>The size of the authentication tag in bytes.</dd></dl>
|
|
<p>By default this function should return the largest tag size supported by the authenticated cipher.</p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classAuthenticatedCipher.html#a73fa4306053ed457e5c533b3127391c9" title="Finalizes the encryption process and computes the authentication tag. ">computeTag()</a> </dd></dl>
|
|
|
|
<p>Implemented in <a class="el" href="classAcorn128.html#a75c8953cea6b9cd59aa5034dfe739889">Acorn128</a>, <a class="el" href="classChaChaPoly.html#a086c2aea395ab31136ebe7805591fd0a">ChaChaPoly</a>, <a class="el" href="classEAXCommon.html#a8804341b21f752a5b8178a3bdb123fd9">EAXCommon</a>, <a class="el" href="classGCMCommon.html#a935f343858e98ee331706daf43e34805">GCMCommon</a>, and <a class="el" href="classAscon128.html#aae49ea7143e32dcf2081b870edba3843">Ascon128</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<hr/>The documentation for this class was generated from the following files:<ul>
|
|
<li><a class="el" href="AuthenticatedCipher_8h_source.html">AuthenticatedCipher.h</a></li>
|
|
<li><a class="el" href="AuthenticatedCipher_8cpp_source.html">AuthenticatedCipher.cpp</a></li>
|
|
</ul>
|
|
</div><!-- contents -->
|
|
<!-- start footer part -->
|
|
<hr class="footer"/><address class="footer"><small>
|
|
Generated on Fri Apr 27 2018 12:01:32 for Arduino Cryptography Library by  <a href="http://www.doxygen.org/index.html">
|
|
<img class="footer" src="doxygen.png" alt="doxygen"/>
|
|
</a> 1.8.6
|
|
</small></address>
|
|
</body>
|
|
</html>
|