mirror of
https://github.com/taigrr/arduinolibs
synced 2025-01-18 04:33:12 -08:00
493 lines
35 KiB
HTML
493 lines
35 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: Cipher 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="classCipher-members.html">List of all members</a> </div>
|
|
<div class="headertitle">
|
|
<div class="title">Cipher Class Reference<span class="mlabels"><span class="mlabel">abstract</span></span></div> </div>
|
|
</div><!--header-->
|
|
<div class="contents">
|
|
|
|
<p>Abstract base class for stream ciphers.
|
|
<a href="classCipher.html#details">More...</a></p>
|
|
|
|
<p><code>#include <<a class="el" href="Cipher_8h_source.html">Cipher.h</a>></code></p>
|
|
<div class="dynheader">
|
|
Inheritance diagram for Cipher:</div>
|
|
<div class="dyncontent">
|
|
<div class="center">
|
|
<img src="classCipher.png" usemap="#Cipher_map" alt=""/>
|
|
<map id="Cipher_map" name="Cipher_map">
|
|
<area href="classAuthenticatedCipher.html" title="Abstract base class for authenticated ciphers. " alt="AuthenticatedCipher" shape="rect" coords="0,56,127,80"/>
|
|
<area href="classCBCCommon.html" title="Concrete base class to assist with implementing CBC for 128-bit block ciphers. " alt="CBCCommon" shape="rect" coords="274,56,401,80"/>
|
|
<area href="classCFBCommon.html" title="Concrete base class to assist with implementing CFB for 128-bit block ciphers. " alt="CFBCommon" shape="rect" coords="411,56,538,80"/>
|
|
<area href="classChaCha.html" title="ChaCha stream cipher. " alt="ChaCha" shape="rect" coords="548,56,675,80"/>
|
|
<area href="classCTRCommon.html" title="Concrete base class to assist with implementing CTR mode for 128-bit block ciphers. " alt="CTRCommon" shape="rect" coords="685,56,812,80"/>
|
|
<area href="classOFBCommon.html" title="Concrete base class to assist with implementing OFB for 128-bit block ciphers. " alt="OFBCommon" shape="rect" coords="822,56,949,80"/>
|
|
<area href="classAcorn128.html" title="ACORN-128 authenticated cipher. " alt="Acorn128" shape="rect" coords="137,112,264,136"/>
|
|
<area href="classAscon128.html" title="ASCON-128 authenticated cipher. " alt="Ascon128" shape="rect" coords="137,168,264,192"/>
|
|
<area href="classChaChaPoly.html" title="Authenticated cipher based on ChaCha and Poly1305. " alt="ChaChaPoly" shape="rect" coords="137,224,264,248"/>
|
|
<area href="classEAXCommon.html" title="Concrete base class to assist with implementing EAX for 128-bit block ciphers. " alt="EAXCommon" shape="rect" coords="137,280,264,304"/>
|
|
<area href="classGCMCommon.html" title="Concrete base class to assist with implementing GCM for 128-bit block ciphers. " alt="GCMCommon" shape="rect" coords="137,336,264,360"/>
|
|
<area href="classCBC.html" title="Implementation of the Cipher Block Chaining (CBC) mode for 128-bit block ciphers. ..." alt="CBC< T >" shape="rect" coords="274,112,401,136"/>
|
|
<area href="classCFB.html" title="Implementation of the Cipher Feedback (CFB) mode for 128-bit block ciphers. " alt="CFB< T >" shape="rect" coords="411,112,538,136"/>
|
|
<area href="classCTR.html" title="Implementation of the Counter (CTR) mode for 128-bit block ciphers. " alt="CTR< T >" shape="rect" coords="685,112,812,136"/>
|
|
<area href="classOFB.html" title="Implementation of the Output Feedback (OFB) mode for 128-bit block ciphers. " alt="OFB< T >" shape="rect" coords="822,112,949,136"/>
|
|
</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:a6a61077eca3ccd5900f92ceac58fb09c"><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"><td class="mdescLeft"> </td><td class="mdescRight">Constructs a new cipher object. <br/></td></tr>
|
|
<tr class="separator:a6a61077eca3ccd5900f92ceac58fb09c"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a84bdea765f7e35aa5b5950dd2853a383"><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"><td class="mdescLeft"> </td><td class="mdescRight">Destroys this cipher object. <a href="#a84bdea765f7e35aa5b5950dd2853a383">More...</a><br/></td></tr>
|
|
<tr class="separator:a84bdea765f7e35aa5b5950dd2853a383"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a4cea432ea0278c865441f17cbb88b1ab"><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"><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"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ab8b53ddc4ce431f03c2a1903d70ace9c"><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"><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"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a0dfe133bda81dfa680b668f5908ccbe5"><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"><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"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a3777acd8ff776a4e945bb7c9f2d044d9"><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"><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"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ad2832bd61039d61560e34ea3382ca562"><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"><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"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:ac6099d1a0d7f2ff67b0e4ccb4a17eb08"><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"><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"><td class="memSeparator" colspan="2"> </td></tr>
|
|
<tr class="memitem:a4b7c3965646441a70d9ab934a7c92ab1"><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"><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"><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 stream ciphers. </p>
|
|
<p>This class is intended for implementing ciphers that operate on arbitrary amounts of data. In particular, stream ciphers where the number of bytes that are input 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> is exactly the same as the number of bytes that are output.</p>
|
|
<p>All of the stream ciphers such as <a class="el" href="classChaCha.html" title="ChaCha stream cipher. ">ChaCha</a> inherit directly from this class, together with block cipher modes such as <a class="el" href="classCTR.html" title="Implementation of the Counter (CTR) mode for 128-bit block ciphers. ">CTR</a> and <a class="el" href="classCFB.html" title="Implementation of the Cipher Feedback (CFB) mode for 128-bit block ciphers. ">CFB</a>. </p>
|
|
|
|
<p>Definition at line <a class="el" href="Cipher_8h_source.html#l00029">29</a> of file <a class="el" href="Cipher_8h_source.html">Cipher.h</a>.</p>
|
|
</div><h2 class="groupheader">Constructor & Destructor Documentation</h2>
|
|
<a class="anchor" id="a84bdea765f7e35aa5b5950dd2853a383"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">Cipher::~Cipher </td>
|
|
<td>(</td>
|
|
<td class="paramname"></td><td>)</td>
|
|
<td></td>
|
|
</tr>
|
|
</table>
|
|
</td>
|
|
<td class="mlabels-right">
|
|
<span class="mlabels"><span class="mlabel">virtual</span></span> </td>
|
|
</tr>
|
|
</table>
|
|
</div><div class="memdoc">
|
|
|
|
<p>Destroys this cipher object. </p>
|
|
<p>Subclasses are responsible for clearing temporary key schedules and other buffers so as to avoid leaking sensitive information.</p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classCipher.html#a4b7c3965646441a70d9ab934a7c92ab1" title="Clears all security-sensitive state from this cipher. ">clear()</a> </dd></dl>
|
|
|
|
<p>Definition at line <a class="el" href="Cipher_8cpp_source.html#l00053">53</a> of file <a class="el" href="Cipher_8cpp_source.html">Cipher.cpp</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<h2 class="groupheader">Member Function Documentation</h2>
|
|
<a class="anchor" id="a4b7c3965646441a70d9ab934a7c92ab1"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void Cipher::clear </td>
|
|
<td>(</td>
|
|
<td class="paramname"></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>Clears all security-sensitive state from this cipher. </p>
|
|
<p>Security-sensitive information includes key schedules, initialization vectors, and any temporary state that is used by <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> which is stored in the cipher itself. </p>
|
|
|
|
<p>Implemented in <a class="el" href="classAcorn128.html#ac98fa6f3ad9f12b090d678d94ffff56f">Acorn128</a>, <a class="el" href="classChaChaPoly.html#a2d7fc3fd05a0b6c7c9c21fff6e939c9a">ChaChaPoly</a>, <a class="el" href="classEAXCommon.html#afa88b0f589e09103e9c69ace081db0af">EAXCommon</a>, <a class="el" href="classGCMCommon.html#a06868ebd67a571aa68d88d5d072cece9">GCMCommon</a>, <a class="el" href="classChaCha.html#af533905f679066c41f4d6cd76bddb4cb">ChaCha</a>, <a class="el" href="classAscon128.html#a865d4c163401a78144d2dd339e7981bd">Ascon128</a>, <a class="el" href="classCTRCommon.html#ac0d6381c02fe2a8a017ad66d006a6ef2">CTRCommon</a>, <a class="el" href="classCBCCommon.html#a7befadfe7384e0e857a96a59bf3845e9">CBCCommon</a>, <a class="el" href="classCFBCommon.html#a847d320b0fe7f329385f26511b42c40d">CFBCommon</a>, and <a class="el" href="classOFBCommon.html#a55bf2396beb91c457bfc4c20ef5c8123">OFBCommon</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ac6099d1a0d7f2ff67b0e4ccb4a17eb08"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void Cipher::decrypt </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint8_t * </td>
|
|
<td class="paramname"><em>output</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const uint8_t * </td>
|
|
<td class="paramname"><em>input</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>Decrypts an input buffer and writes the plaintext to an output buffer. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">output</td><td>The output buffer to write to, which may be the same buffer as <em>input</em>. The <em>output</em> buffer must have at least as many bytes as the <em>input</em> buffer. </td></tr>
|
|
<tr><td class="paramname">input</td><td>The input buffer to read from. </td></tr>
|
|
<tr><td class="paramname">len</td><td>The number of bytes to decrypt.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<p>The <a class="el" href="classCipher.html#ac6099d1a0d7f2ff67b0e4ccb4a17eb08" title="Decrypts an input buffer and writes the plaintext to an output buffer. ">decrypt()</a> function can be called multiple times with different regions of the ciphertext data.</p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classCipher.html#ad2832bd61039d61560e34ea3382ca562" title="Encrypts an input buffer and writes the ciphertext to an output buffer. ">encrypt()</a> </dd></dl>
|
|
|
|
<p>Implemented in <a class="el" href="classAcorn128.html#a7eacfc496f19b691207f64ba58b4c14a">Acorn128</a>, <a class="el" href="classChaCha.html#a1f54b2b51b59428010f81a6c4dc4e42c">ChaCha</a>, <a class="el" href="classChaChaPoly.html#a42f556f202b1166486434ee15b6d95a0">ChaChaPoly</a>, <a class="el" href="classCTRCommon.html#a0943387cf1124258389702e0690740fe">CTRCommon</a>, <a class="el" href="classEAXCommon.html#a63ce8ae45db137ec9d447216b84245c2">EAXCommon</a>, <a class="el" href="classGCMCommon.html#a60912d3ab5766aa68dc9b3111ac2c0d7">GCMCommon</a>, <a class="el" href="classAscon128.html#a65fa85aa7f8aab1d8bc67b48f2c3abbb">Ascon128</a>, <a class="el" href="classCBCCommon.html#ab46a2625cae9a654c708e1f31a0e22b6">CBCCommon</a>, <a class="el" href="classCFBCommon.html#aaaa3d61c5743e30e355207c193c0b0ef">CFBCommon</a>, and <a class="el" href="classOFBCommon.html#aeb3636d7175b150e2bf16367e51c2e36">OFBCommon</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ad2832bd61039d61560e34ea3382ca562"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">void Cipher::encrypt </td>
|
|
<td>(</td>
|
|
<td class="paramtype">uint8_t * </td>
|
|
<td class="paramname"><em>output</em>, </td>
|
|
</tr>
|
|
<tr>
|
|
<td class="paramkey"></td>
|
|
<td></td>
|
|
<td class="paramtype">const uint8_t * </td>
|
|
<td class="paramname"><em>input</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>Encrypts an input buffer and writes the ciphertext to an output buffer. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">output</td><td>The output buffer to write to, which may be the same buffer as <em>input</em>. The <em>output</em> buffer must have at least as many bytes as the <em>input</em> buffer. </td></tr>
|
|
<tr><td class="paramname">input</td><td>The input buffer to read from. </td></tr>
|
|
<tr><td class="paramname">len</td><td>The number of bytes to encrypt.</td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<p>The <a class="el" href="classCipher.html#ad2832bd61039d61560e34ea3382ca562" title="Encrypts an input buffer and writes the ciphertext to an output buffer. ">encrypt()</a> function can be called multiple times with different regions of the plaintext data.</p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classCipher.html#ac6099d1a0d7f2ff67b0e4ccb4a17eb08" title="Decrypts an input buffer and writes the plaintext to an output buffer. ">decrypt()</a> </dd></dl>
|
|
|
|
<p>Implemented in <a class="el" href="classAcorn128.html#a4273a0b1eb880d98e34f2f9123fa167b">Acorn128</a>, <a class="el" href="classChaCha.html#acd4fff140b8871c233d9a31abf753ed8">ChaCha</a>, <a class="el" href="classChaChaPoly.html#a7df4acd04f459ecf9d3b24317bde94a3">ChaChaPoly</a>, <a class="el" href="classCTRCommon.html#a201bda584d111552ce8ec09fac759963">CTRCommon</a>, <a class="el" href="classEAXCommon.html#aad2c563f749535f539b8efbd74b09099">EAXCommon</a>, <a class="el" href="classGCMCommon.html#a01ac69afe3d9fc4d72b2ea5dc242e55c">GCMCommon</a>, <a class="el" href="classAscon128.html#a6922df692c23b793c7a453bea7cbfe7f">Ascon128</a>, <a class="el" href="classCBCCommon.html#a41d2f655a7df13cfcd009b2882e13147">CBCCommon</a>, <a class="el" href="classCFBCommon.html#a57af3692389bed300d3cfdf351351c51">CFBCommon</a>, and <a class="el" href="classOFBCommon.html#a984d81a460e0799895b19dc48c3b5cf8">OFBCommon</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="ab8b53ddc4ce431f03c2a1903d70ace9c"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t Cipher::ivSize </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>Size of the initialization vector for this cipher, in bytes. </p>
|
|
<p>If the cipher does not need an initialization vector, this function will return zero. </p>
|
|
|
|
<p>Implemented in <a class="el" href="classAcorn128.html#a4141564021e8233727beb5b9f645dc4e">Acorn128</a>, <a class="el" href="classChaCha.html#afaa3df343a7d07976bd7e03a0c1bf43c">ChaCha</a>, <a class="el" href="classChaChaPoly.html#ac3ebfaaaffe9d607905681949e75140d">ChaChaPoly</a>, <a class="el" href="classEAXCommon.html#abc6ccfb9338c94699458723f669513bf">EAXCommon</a>, <a class="el" href="classGCMCommon.html#a01cff072505e861fd20f6cfee1e10fb2">GCMCommon</a>, <a class="el" href="classCTRCommon.html#a98c1717d11d8da8e1fa108607358774a">CTRCommon</a>, <a class="el" href="classAscon128.html#a32a4fe685f92378493ab3f058971228e">Ascon128</a>, <a class="el" href="classCBCCommon.html#a016277533730284a38bb6ad8cd6f91ce">CBCCommon</a>, <a class="el" href="classCFBCommon.html#a55db1be69de87aafe5601d31be918ebb">CFBCommon</a>, and <a class="el" href="classOFBCommon.html#a67b4639aaece17a796fcba3a2ce8b43c">OFBCommon</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a4cea432ea0278c865441f17cbb88b1ab"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">size_t Cipher::keySize </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>Default size of the key for this cipher, in bytes. </p>
|
|
<p>If the cipher supports variable-sized keys, <a class="el" href="classCipher.html#a4cea432ea0278c865441f17cbb88b1ab" title="Default size of the key for this cipher, in bytes. ">keySize()</a> indicates the default or recommended key size. The cipher may support other key sizes.</p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classCipher.html#a0dfe133bda81dfa680b668f5908ccbe5" title="Sets the key to use for future encryption and decryption operations. ">setKey()</a>, <a class="el" href="classCipher.html#ab8b53ddc4ce431f03c2a1903d70ace9c" title="Size of the initialization vector for this cipher, in bytes. ">ivSize()</a> </dd></dl>
|
|
|
|
<p>Implemented in <a class="el" href="classAcorn128.html#af13cffd088e6ec25f9f781bea22fba12">Acorn128</a>, <a class="el" href="classChaCha.html#af286083291fab2bd36dc7ad1f54d5cd7">ChaCha</a>, <a class="el" href="classChaChaPoly.html#a666760e68cb53f28ba0a8dc09039c0fb">ChaChaPoly</a>, <a class="el" href="classEAXCommon.html#a027956913eecfa0bc760f20f3b62df29">EAXCommon</a>, <a class="el" href="classGCMCommon.html#a134ba35e740a18bee3c45502b4149eae">GCMCommon</a>, <a class="el" href="classCTRCommon.html#a29ce8e13a302350397fc6790a686bea2">CTRCommon</a>, <a class="el" href="classAscon128.html#aa76a734d4746e73a27688a678c005528">Ascon128</a>, <a class="el" href="classCBCCommon.html#adb7daacfe2a4fca3d13b62b75372fe4e">CBCCommon</a>, <a class="el" href="classCFBCommon.html#a82899da983bc70bc8152ee67f424552e">CFBCommon</a>, and <a class="el" href="classOFBCommon.html#a76ea9f9ea9dd137778338813e534a8ce">OFBCommon</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a3777acd8ff776a4e945bb7c9f2d044d9"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">bool Cipher::setIV </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const uint8_t * </td>
|
|
<td class="paramname"><em>iv</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>Sets the initialization vector to use for future encryption and decryption operations. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">iv</td><td>The initialization vector to use. </td></tr>
|
|
<tr><td class="paramname">len</td><td>The length of the initialization vector in bytes. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>Returns false if the length is not supported.</dd></dl>
|
|
<p>Initialization vectors should be set 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> after a <a class="el" href="classCipher.html#a0dfe133bda81dfa680b668f5908ccbe5" title="Sets the key to use for future encryption and decryption operations. ">setKey()</a> call. If the initialization vector is changed after encryption or decryption begins, then the behaviour is undefined.</p>
|
|
<dl class="section note"><dt>Note</dt><dd>The IV is not encoded into the output stream by <a class="el" href="classCipher.html#ad2832bd61039d61560e34ea3382ca562" title="Encrypts an input buffer and writes the ciphertext to an output buffer. ">encrypt()</a>. The caller is responsible for communicating the IV to the other party.</dd></dl>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classCipher.html#ab8b53ddc4ce431f03c2a1903d70ace9c" title="Size of the initialization vector for this cipher, in bytes. ">ivSize()</a> </dd></dl>
|
|
|
|
<p>Implemented in <a class="el" href="classAcorn128.html#ae4e9ecf2030c4d2e3f32a19f937de845">Acorn128</a>, <a class="el" href="classChaCha.html#a734f3246b1e6810c63637b8cda26b259">ChaCha</a>, <a class="el" href="classChaChaPoly.html#a308056b17b3a4a496e9612ae19a2fd6f">ChaChaPoly</a>, <a class="el" href="classCTRCommon.html#aad289af3eb013cb3ffda6d7e8e8b3d04">CTRCommon</a>, <a class="el" href="classEAXCommon.html#a33a5da1f210f01c3622fbf27208f3d45">EAXCommon</a>, <a class="el" href="classGCMCommon.html#a2545135fe42c832e40e057b603824524">GCMCommon</a>, <a class="el" href="classAscon128.html#a7fa16c1ee860b2f76011d7852dc8ec96">Ascon128</a>, <a class="el" href="classCBCCommon.html#ac7a586217835055b3a354bb932db160c">CBCCommon</a>, <a class="el" href="classCFBCommon.html#a597040eb7df40adbbef94b4c3975cd80">CFBCommon</a>, and <a class="el" href="classOFBCommon.html#a4a35364cf30d78f1968cc00803686caf">OFBCommon</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<a class="anchor" id="a0dfe133bda81dfa680b668f5908ccbe5"></a>
|
|
<div class="memitem">
|
|
<div class="memproto">
|
|
<table class="mlabels">
|
|
<tr>
|
|
<td class="mlabels-left">
|
|
<table class="memname">
|
|
<tr>
|
|
<td class="memname">bool Cipher::setKey </td>
|
|
<td>(</td>
|
|
<td class="paramtype">const uint8_t * </td>
|
|
<td class="paramname"><em>key</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>Sets the key to use for future encryption and decryption operations. </p>
|
|
<dl class="params"><dt>Parameters</dt><dd>
|
|
<table class="params">
|
|
<tr><td class="paramname">key</td><td>The key to use. </td></tr>
|
|
<tr><td class="paramname">len</td><td>The length of the key in bytes. </td></tr>
|
|
</table>
|
|
</dd>
|
|
</dl>
|
|
<dl class="section return"><dt>Returns</dt><dd>Returns false if the key length is not supported, or the key is somehow "weak" and unusable by this cipher.</dd></dl>
|
|
<p>Use <a class="el" href="classCipher.html#a4b7c3965646441a70d9ab934a7c92ab1" title="Clears all security-sensitive state from this cipher. ">clear()</a> or the destructor to remove the key and any other sensitive data from the object once encryption or decryption is complete.</p>
|
|
<p>Calling <a class="el" href="classCipher.html#a0dfe133bda81dfa680b668f5908ccbe5" title="Sets the key to use for future encryption and decryption operations. ">setKey()</a> resets the cipher. Any temporary data that was being retained for encrypting partial blocks will be abandoned.</p>
|
|
<dl class="section see"><dt>See Also</dt><dd><a class="el" href="classCipher.html#a4cea432ea0278c865441f17cbb88b1ab" title="Default size of the key for this cipher, in bytes. ">keySize()</a>, <a class="el" href="classCipher.html#a4b7c3965646441a70d9ab934a7c92ab1" title="Clears all security-sensitive state from this cipher. ">clear()</a> </dd></dl>
|
|
|
|
<p>Implemented in <a class="el" href="classAcorn128.html#a2a2b2285ffc4d0ed57d661d739d22302">Acorn128</a>, <a class="el" href="classChaCha.html#a6b2bdffbd3705e388bb458edb2f40c90">ChaCha</a>, <a class="el" href="classChaChaPoly.html#ae300892647dd92cbce711b834aa20c09">ChaChaPoly</a>, <a class="el" href="classCTRCommon.html#a79da937dc2c444a174176beab33c055a">CTRCommon</a>, <a class="el" href="classEAXCommon.html#af5be5115c119610abb351028263d28de">EAXCommon</a>, <a class="el" href="classGCMCommon.html#a397c5dddde828c59eb63367385aec562">GCMCommon</a>, <a class="el" href="classAscon128.html#afbf59ccc30d6c3452b10a571bbe623e0">Ascon128</a>, <a class="el" href="classCBCCommon.html#add75ea4342a190e560cee26a8e9efc37">CBCCommon</a>, <a class="el" href="classCFBCommon.html#a45b9be25fb96f0e3ca5211b064e2baea">CFBCommon</a>, and <a class="el" href="classOFBCommon.html#ac3a98e81d95ebc6c883baef5f4cfbefb">OFBCommon</a>.</p>
|
|
|
|
</div>
|
|
</div>
|
|
<hr/>The documentation for this class was generated from the following files:<ul>
|
|
<li><a class="el" href="Cipher_8h_source.html">Cipher.h</a></li>
|
|
<li><a class="el" href="Cipher_8cpp_source.html">Cipher.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>
|