1
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
2
<html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1">
3
<title>Qt Cryptographic Architecture: QCA::Cipher Class Reference</title>
4
<link href="doxygen.css" rel="stylesheet" type="text/css">
5
<link href="tabs.css" rel="stylesheet" type="text/css">
7
<!-- Generated by Doxygen 1.4.6 -->
10
<li><a href="index.html"><span>Main Page</span></a></li>
11
<li><a href="namespaces.html"><span>Namespaces</span></a></li>
12
<li id="current"><a href="annotated.html"><span>Classes</span></a></li>
13
<li><a href="files.html"><span>Files</span></a></li>
14
<li><a href="dirs.html"><span>Directories</span></a></li>
15
<li><a href="pages.html"><span>Related Pages</span></a></li>
16
<li><a href="examples.html"><span>Examples</span></a></li>
20
<li><a href="annotated.html"><span>Class List</span></a></li>
21
<li><a href="hierarchy.html"><span>Class Hierarchy</span></a></li>
22
<li><a href="functions.html"><span>Class Members</span></a></li>
25
<a class="el" href="namespaceQCA.html">QCA</a>::<a class="el" href="classQCA_1_1Cipher.html">Cipher</a></div>
26
<h1>QCA::Cipher Class Reference</h1><!-- doxytag: class="QCA::Cipher" --><!-- doxytag: inherits="QCA::Algorithm,QCA::Filter" -->General class for cipher (encryption / decryption) algorithms.
27
<a href="#_details">More...</a>
29
<code>#include <<a class="el" href="qca__basic_8h-source.html">QtCrypto</a>></code>
31
<p>Inheritance diagram for QCA::Cipher:
32
<p><center><img src="classQCA_1_1Cipher.png" usemap="#QCA::Cipher_map" border="0" alt=""></center>
33
<map name="QCA::Cipher_map">
34
<area href="classQCA_1_1Algorithm.html" alt="QCA::Algorithm" shape="rect" coords="0,0,99,24">
35
<area href="classQCA_1_1Filter.html" alt="QCA::Filter" shape="rect" coords="109,0,208,24">
37
Collaboration diagram for QCA::Cipher:<p><center><img src="classQCA_1_1Cipher__coll__graph.png" border="0" usemap="#QCA_1_1Cipher__coll__map" alt="Collaboration graph"></center>
38
<map name="QCA_1_1Cipher__coll__map">
39
<area href="classQCA_1_1Algorithm.html" shape="rect" coords="54,100,169,124" alt="">
40
<area doxygen="qt.tag:" href="qshareddatapointer.html" shape="rect" coords="7,9,215,33" alt="">
41
<area href="classQCA_1_1Filter.html" shape="rect" coords="193,100,281,124" alt="">
43
<center><font size="2">[<a href="graph_legend.html">legend</a>]</font></center><a href="classQCA_1_1Cipher-members.html">List of all members.</a><table border="0" cellpadding="0" cellspacing="0">
45
<tr><td colspan="2"><br><h2>Public Types</h2></td></tr>
46
<tr><td class="memItemLeft" nowrap align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCA_1_1Cipher.html#55df34874dc7565d7de238d2d742d66b">Mode</a> { <a class="el" href="classQCA_1_1Cipher.html#55df34874dc7565d7de238d2d742d66b86eb7f24db68cab4954bac608b6df0f8">CBC</a>,
47
<a class="el" href="classQCA_1_1Cipher.html#55df34874dc7565d7de238d2d742d66b48a41672676d0f44d494331f31eb08f6">CFB</a>,
48
<a class="el" href="classQCA_1_1Cipher.html#55df34874dc7565d7de238d2d742d66b2242c6ac6d37ac39d20d85486b113dbb">ECB</a>,
49
<a class="el" href="classQCA_1_1Cipher.html#55df34874dc7565d7de238d2d742d66b3cf1ddcbb9543e64c9b70bdf75d2da20">OFB</a>
52
<tr><td class="memItemLeft" nowrap align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCA_1_1Cipher.html#eafc444370fbd6d1457580da2f00c52b">Padding</a> { <a class="el" href="classQCA_1_1Cipher.html#eafc444370fbd6d1457580da2f00c52b402325f324be592311fcfe5ea0526747">DefaultPadding</a>,
53
<a class="el" href="classQCA_1_1Cipher.html#eafc444370fbd6d1457580da2f00c52b14576feb70dce92f2ce3bc0143742866">NoPadding</a>,
54
<a class="el" href="classQCA_1_1Cipher.html#eafc444370fbd6d1457580da2f00c52bef40f7173d895c7ae1a32625cd3eef3b">PKCS7</a>
57
<tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr>
58
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCA_1_1Cipher.html#9ed78ff1f6d3e9b9ed1d8eebdb7540e3">Cipher</a> (const <a class="elRef" doxygen="qt.tag:" href="qstring.html">QString</a> &type, <a class="el" href="classQCA_1_1Cipher.html#55df34874dc7565d7de238d2d742d66b">Mode</a> mode, <a class="el" href="classQCA_1_1Cipher.html#eafc444370fbd6d1457580da2f00c52b">Padding</a> pad=DefaultPadding, <a class="el" href="namespaceQCA.html#8e5d1994b00ea69c9a598f93cd0990ce">Direction</a> dir=Encode, const <a class="el" href="classQCA_1_1SymmetricKey.html">SymmetricKey</a> &key=<a class="el" href="classQCA_1_1SymmetricKey.html">SymmetricKey</a>(), const <a class="el" href="classQCA_1_1InitializationVector.html">InitializationVector</a> &iv=<a class="el" href="classQCA_1_1InitializationVector.html">InitializationVector</a>(), const <a class="elRef" doxygen="qt.tag:" href="qstring.html">QString</a> &provider=<a class="elRef" doxygen="qt.tag:" href="qstring.html">QString</a>())</td></tr>
60
<tr><td class="memItemLeft" nowrap align="right" valign="top"> </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCA_1_1Cipher.html#bec28c3a9dd07c57f7878d0e036d3ab6">Cipher</a> (const <a class="el" href="classQCA_1_1Cipher.html">Cipher</a> &from)</td></tr>
62
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classQCA_1_1Cipher.html">Cipher</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCA_1_1Cipher.html#3a3562c8db00240c37fdb59519ce37fa">operator=</a> (const <a class="el" href="classQCA_1_1Cipher.html">Cipher</a> &from)</td></tr>
64
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="elRef" doxygen="qt.tag:" href="qstring.html">QString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCA_1_1Cipher.html#f5f60cff34b3d194878dc720c2772f56">type</a> () const </td></tr>
66
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classQCA_1_1Cipher.html#55df34874dc7565d7de238d2d742d66b">Mode</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCA_1_1Cipher.html#01c2511aed6f31a0f676f84d7a3f0cd7">mode</a> () const </td></tr>
68
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classQCA_1_1Cipher.html#eafc444370fbd6d1457580da2f00c52b">Padding</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCA_1_1Cipher.html#a1a3f7287378c34d627540cab7a2bf01">padding</a> () const </td></tr>
70
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="namespaceQCA.html#8e5d1994b00ea69c9a598f93cd0990ce">Direction</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCA_1_1Cipher.html#cf1992168fae016c5f7531a4ee757de8">direction</a> () const </td></tr>
72
<tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="classQCA_1_1KeyLength.html">KeyLength</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCA_1_1Cipher.html#2a4e19ab0ea7d8fc52e9c3d2f84aab02">keyLength</a> () const </td></tr>
74
<tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCA_1_1Cipher.html#1a0f3bb31878baceb8c9bd7718f2c3d6">validKeyLength</a> (int n) const </td></tr>
76
<tr><td class="memItemLeft" nowrap align="right" valign="top">int </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCA_1_1Cipher.html#c7d30a5ccf512e0625e307a10aebf6e1">blockSize</a> () const </td></tr>
78
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCA_1_1Cipher.html#6c51f4e2583e779e3793113c2b397a4f">clear</a> ()</td></tr>
80
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="classQCA_1_1MemoryRegion.html">MemoryRegion</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCA_1_1Cipher.html#a730707a1fb3fef1f3d02b4afcfacab2">update</a> (const <a class="el" href="classQCA_1_1MemoryRegion.html">MemoryRegion</a> &a)</td></tr>
82
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual <a class="el" href="classQCA_1_1MemoryRegion.html">MemoryRegion</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCA_1_1Cipher.html#bdab1417eb8dc7e8dd16d94ce031b490">final</a> ()</td></tr>
84
<tr><td class="memItemLeft" nowrap align="right" valign="top">virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCA_1_1Cipher.html#12dae396f29a4241c13fb6f35489574f">ok</a> () const </td></tr>
86
<tr><td class="memItemLeft" nowrap align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCA_1_1Cipher.html#69b2257eeeacc4ff01166a45a662e8c7">setup</a> (<a class="el" href="namespaceQCA.html#8e5d1994b00ea69c9a598f93cd0990ce">Direction</a> dir, const <a class="el" href="classQCA_1_1SymmetricKey.html">SymmetricKey</a> &key, const <a class="el" href="classQCA_1_1InitializationVector.html">InitializationVector</a> &iv=<a class="el" href="classQCA_1_1InitializationVector.html">InitializationVector</a>())</td></tr>
88
<tr><td colspan="2"><br><h2>Static Public Member Functions</h2></td></tr>
89
<tr><td class="memItemLeft" nowrap align="right" valign="top">static <a class="elRef" doxygen="qt.tag:" href="qstring.html">QString</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="classQCA_1_1Cipher.html#9be656582ff71957adbddf5ebabeb031">withAlgorithms</a> (const <a class="elRef" doxygen="qt.tag:" href="qstring.html">QString</a> &cipherType, <a class="el" href="classQCA_1_1Cipher.html#55df34874dc7565d7de238d2d742d66b">Mode</a> modeType, <a class="el" href="classQCA_1_1Cipher.html#eafc444370fbd6d1457580da2f00c52b">Padding</a> paddingType)</td></tr>
92
<hr><a name="_details"></a><h2>Detailed Description</h2>
93
General class for cipher (encryption / decryption) algorithms.
95
<a class="el" href="classQCA_1_1Cipher.html">Cipher</a> is the class for the various algorithms that perform low level encryption and decryption within QCA.<p>
96
AES128, AES192 and AES256 are recommended for new applications.<p>
97
Standard names for ciphers are:<ul>
98
<li>Blowfish - "blowfish"</li><li>TripleDES - "tripledes"</li><li>DES - "des"</li><li>AES128 - "aes128"</li><li>AES192 - "aes192"</li><li>AES256 - "aes256" </li></ul>
99
<dl compact><dt><b>Examples: </b></dt><dd>
102
<a class="el" href="aes-cmac_8cpp-example.html#_a3">aes-cmac.cpp</a>, and <a class="el" href="ciphertest_8cpp-example.html#_a54">ciphertest.cpp</a>.</dl>
104
<hr><h2>Member Enumeration Documentation</h2>
105
<a class="anchor" name="55df34874dc7565d7de238d2d742d66b"></a><!-- doxytag: member="QCA::Cipher::Mode" ref="55df34874dc7565d7de238d2d742d66b" args="" --><p>
106
<table class="mdTable" cellpadding="2" cellspacing="0">
109
<table cellpadding="0" cellspacing="0" border="0">
111
<td class="md" nowrap valign="top">enum <a class="el" href="classQCA_1_1Cipher.html#55df34874dc7565d7de238d2d742d66b">QCA::Cipher::Mode</a> </td>
117
<table cellspacing="5" cellpadding="0" border="0">
125
Mode settings for cipher algorithms.
127
<dl compact><dt><b>Enumerator: </b></dt><dd>
128
<table border="0" cellspacing="2" cellpadding="0">
129
<tr><td valign="top"><em><a class="anchor" name="55df34874dc7565d7de238d2d742d66b86eb7f24db68cab4954bac608b6df0f8"></a><!-- doxytag: member="CBC" ref="55df34874dc7565d7de238d2d742d66b86eb7f24db68cab4954bac608b6df0f8" args="" -->CBC</em> </td><td>
130
operate in Cipher Block Chaining mode </td></tr>
131
<tr><td valign="top"><em><a class="anchor" name="55df34874dc7565d7de238d2d742d66b48a41672676d0f44d494331f31eb08f6"></a><!-- doxytag: member="CFB" ref="55df34874dc7565d7de238d2d742d66b48a41672676d0f44d494331f31eb08f6" args="" -->CFB</em> </td><td>
132
operate in Cipher FeedBack mode </td></tr>
133
<tr><td valign="top"><em><a class="anchor" name="55df34874dc7565d7de238d2d742d66b2242c6ac6d37ac39d20d85486b113dbb"></a><!-- doxytag: member="ECB" ref="55df34874dc7565d7de238d2d742d66b2242c6ac6d37ac39d20d85486b113dbb" args="" -->ECB</em> </td><td>
134
operate in Electronic Code Book mode </td></tr>
135
<tr><td valign="top"><em><a class="anchor" name="55df34874dc7565d7de238d2d742d66b3cf1ddcbb9543e64c9b70bdf75d2da20"></a><!-- doxytag: member="OFB" ref="55df34874dc7565d7de238d2d742d66b3cf1ddcbb9543e64c9b70bdf75d2da20" args="" -->OFB</em> </td><td>
136
operate in Output FeedBack Mode </td></tr>
142
<a class="anchor" name="eafc444370fbd6d1457580da2f00c52b"></a><!-- doxytag: member="QCA::Cipher::Padding" ref="eafc444370fbd6d1457580da2f00c52b" args="" --><p>
143
<table class="mdTable" cellpadding="2" cellspacing="0">
146
<table cellpadding="0" cellspacing="0" border="0">
148
<td class="md" nowrap valign="top">enum <a class="el" href="classQCA_1_1Cipher.html#eafc444370fbd6d1457580da2f00c52b">QCA::Cipher::Padding</a> </td>
154
<table cellspacing="5" cellpadding="0" border="0">
162
Padding variations for cipher algorithms.
164
<dl compact><dt><b>Enumerator: </b></dt><dd>
165
<table border="0" cellspacing="2" cellpadding="0">
166
<tr><td valign="top"><em><a class="anchor" name="eafc444370fbd6d1457580da2f00c52b402325f324be592311fcfe5ea0526747"></a><!-- doxytag: member="DefaultPadding" ref="eafc444370fbd6d1457580da2f00c52b402325f324be592311fcfe5ea0526747" args="" -->DefaultPadding</em> </td><td>
167
Default for cipher-mode. </td></tr>
168
<tr><td valign="top"><em><a class="anchor" name="eafc444370fbd6d1457580da2f00c52b14576feb70dce92f2ce3bc0143742866"></a><!-- doxytag: member="NoPadding" ref="eafc444370fbd6d1457580da2f00c52b14576feb70dce92f2ce3bc0143742866" args="" -->NoPadding</em> </td><td>
169
Do not use padding. </td></tr>
170
<tr><td valign="top"><em><a class="anchor" name="eafc444370fbd6d1457580da2f00c52bef40f7173d895c7ae1a32625cd3eef3b"></a><!-- doxytag: member="PKCS7" ref="eafc444370fbd6d1457580da2f00c52bef40f7173d895c7ae1a32625cd3eef3b" args="" -->PKCS7</em> </td><td>
171
Pad using the scheme in PKCS#7. </td></tr>
177
<hr><h2>Constructor & Destructor Documentation</h2>
178
<a class="anchor" name="9ed78ff1f6d3e9b9ed1d8eebdb7540e3"></a><!-- doxytag: member="QCA::Cipher::Cipher" ref="9ed78ff1f6d3e9b9ed1d8eebdb7540e3" args="(const QString &type, Mode mode, Padding pad=DefaultPadding, Direction dir=Encode, const SymmetricKey &key=SymmetricKey(), const InitializationVector &iv=InitializationVector(), const QString &provider=QString())" --><p>
179
<table class="mdTable" cellpadding="2" cellspacing="0">
182
<table cellpadding="0" cellspacing="0" border="0">
184
<td class="md" nowrap valign="top">QCA::Cipher::Cipher </td>
185
<td class="md" valign="top">( </td>
186
<td class="md" nowrap valign="top">const <a class="elRef" doxygen="qt.tag:" href="qstring.html">QString</a> & </td>
187
<td class="mdname" nowrap> <em>type</em>, </td>
190
<td class="md" nowrap align="right"></td>
192
<td class="md" nowrap><a class="el" href="classQCA_1_1Cipher.html#55df34874dc7565d7de238d2d742d66b">Mode</a> </td>
193
<td class="mdname" nowrap> <em>mode</em>, </td>
196
<td class="md" nowrap align="right"></td>
198
<td class="md" nowrap><a class="el" href="classQCA_1_1Cipher.html#eafc444370fbd6d1457580da2f00c52b">Padding</a> </td>
199
<td class="mdname" nowrap> <em>pad</em> = <code>DefaultPadding</code>, </td>
202
<td class="md" nowrap align="right"></td>
204
<td class="md" nowrap><a class="el" href="namespaceQCA.html#8e5d1994b00ea69c9a598f93cd0990ce">Direction</a> </td>
205
<td class="mdname" nowrap> <em>dir</em> = <code>Encode</code>, </td>
208
<td class="md" nowrap align="right"></td>
210
<td class="md" nowrap>const <a class="el" href="classQCA_1_1SymmetricKey.html">SymmetricKey</a> & </td>
211
<td class="mdname" nowrap> <em>key</em> = <code><a class="el" href="classQCA_1_1SymmetricKey.html">SymmetricKey</a>()</code>, </td>
214
<td class="md" nowrap align="right"></td>
216
<td class="md" nowrap>const <a class="el" href="classQCA_1_1InitializationVector.html">InitializationVector</a> & </td>
217
<td class="mdname" nowrap> <em>iv</em> = <code><a class="el" href="classQCA_1_1InitializationVector.html">InitializationVector</a>()</code>, </td>
220
<td class="md" nowrap align="right"></td>
222
<td class="md" nowrap>const <a class="elRef" doxygen="qt.tag:" href="qstring.html">QString</a> & </td>
223
<td class="mdname" nowrap> <em>provider</em> = <code><a class="elRef" doxygen="qt.tag:" href="qstring.html">QString</a>()</code></td>
227
<td class="md">) </td>
228
<td class="md" colspan="2"></td>
234
<table cellspacing="5" cellpadding="0" border="0">
242
Standard constructor.
244
<dl compact><dt><b>Parameters:</b></dt><dd>
245
<table border="0" cellspacing="2" cellpadding="0">
246
<tr><td valign="top"></td><td valign="top"><em>type</em> </td><td>the name of the cipher specialisation to use (e.g. "aes128") </td></tr>
247
<tr><td valign="top"></td><td valign="top"><em>mode</em> </td><td>the operating Mode to use (e.g. <a class="el" href="classQCA_1_1Cipher.html#55df34874dc7565d7de238d2d742d66b86eb7f24db68cab4954bac608b6df0f8">QCA::Cipher::CBC</a>) </td></tr>
248
<tr><td valign="top"></td><td valign="top"><em>pad</em> </td><td>the type of Padding to use </td></tr>
249
<tr><td valign="top"></td><td valign="top"><em>dir</em> </td><td>the Direction that this <a class="el" href="classQCA_1_1Cipher.html">Cipher</a> should use (Encode for encryption, Decode for decryption) </td></tr>
250
<tr><td valign="top"></td><td valign="top"><em>key</em> </td><td>the <a class="el" href="classQCA_1_1SymmetricKey.html">SymmetricKey</a> array that is the key </td></tr>
251
<tr><td valign="top"></td><td valign="top"><em>iv</em> </td><td>the <a class="el" href="classQCA_1_1InitializationVector.html">InitializationVector</a> to use (not used for ECB mode) </td></tr>
252
<tr><td valign="top"></td><td valign="top"><em>provider</em> </td><td>the name of the <a class="el" href="classQCA_1_1Provider.html">Provider</a> to use</td></tr>
255
<dl compact><dt><b>Note:</b></dt><dd>Padding only applies to CBC and ECB modes. CFB and OFB ciphertext is always the length of the plaintext. </dd></dl>
259
<a class="anchor" name="bec28c3a9dd07c57f7878d0e036d3ab6"></a><!-- doxytag: member="QCA::Cipher::Cipher" ref="bec28c3a9dd07c57f7878d0e036d3ab6" args="(const Cipher &from)" --><p>
260
<table class="mdTable" cellpadding="2" cellspacing="0">
263
<table cellpadding="0" cellspacing="0" border="0">
265
<td class="md" nowrap valign="top">QCA::Cipher::Cipher </td>
266
<td class="md" valign="top">( </td>
267
<td class="md" nowrap valign="top">const <a class="el" href="classQCA_1_1Cipher.html">Cipher</a> & </td>
268
<td class="mdname1" valign="top" nowrap> <em>from</em> </td>
269
<td class="md" valign="top"> ) </td>
270
<td class="md" nowrap></td>
276
<table cellspacing="5" cellpadding="0" border="0">
284
Standard copy constructor.
289
<hr><h2>Member Function Documentation</h2>
290
<a class="anchor" name="3a3562c8db00240c37fdb59519ce37fa"></a><!-- doxytag: member="QCA::Cipher::operator=" ref="3a3562c8db00240c37fdb59519ce37fa" args="(const Cipher &from)" --><p>
291
<table class="mdTable" cellpadding="2" cellspacing="0">
294
<table cellpadding="0" cellspacing="0" border="0">
296
<td class="md" nowrap valign="top"><a class="el" href="classQCA_1_1Cipher.html">Cipher</a>& QCA::Cipher::operator= </td>
297
<td class="md" valign="top">( </td>
298
<td class="md" nowrap valign="top">const <a class="el" href="classQCA_1_1Cipher.html">Cipher</a> & </td>
299
<td class="mdname1" valign="top" nowrap> <em>from</em> </td>
300
<td class="md" valign="top"> ) </td>
301
<td class="md" nowrap></td>
307
<table cellspacing="5" cellpadding="0" border="0">
317
<dl compact><dt><b>Parameters:</b></dt><dd>
318
<table border="0" cellspacing="2" cellpadding="0">
319
<tr><td valign="top"></td><td valign="top"><em>from</em> </td><td>the <a class="el" href="classQCA_1_1Cipher.html">Cipher</a> to copy state from </td></tr>
325
<a class="anchor" name="f5f60cff34b3d194878dc720c2772f56"></a><!-- doxytag: member="QCA::Cipher::type" ref="f5f60cff34b3d194878dc720c2772f56" args="() const " --><p>
326
<table class="mdTable" cellpadding="2" cellspacing="0">
329
<table cellpadding="0" cellspacing="0" border="0">
331
<td class="md" nowrap valign="top"><a class="elRef" doxygen="qt.tag:" href="qstring.html">QString</a> QCA::Cipher::type </td>
332
<td class="md" valign="top">( </td>
333
<td class="mdname1" valign="top" nowrap> </td>
334
<td class="md" valign="top"> ) </td>
335
<td class="md" nowrap> const</td>
341
<table cellspacing="5" cellpadding="0" border="0">
349
Return the cipher type.
353
Reimplemented from <a class="el" href="classQCA_1_1Algorithm.html#503255bf0a33bad64c2d2aedc361e4c7">QCA::Algorithm</a>. </td>
356
<a class="anchor" name="01c2511aed6f31a0f676f84d7a3f0cd7"></a><!-- doxytag: member="QCA::Cipher::mode" ref="01c2511aed6f31a0f676f84d7a3f0cd7" args="() const " --><p>
357
<table class="mdTable" cellpadding="2" cellspacing="0">
360
<table cellpadding="0" cellspacing="0" border="0">
362
<td class="md" nowrap valign="top"><a class="el" href="classQCA_1_1Cipher.html#55df34874dc7565d7de238d2d742d66b">Mode</a> QCA::Cipher::mode </td>
363
<td class="md" valign="top">( </td>
364
<td class="mdname1" valign="top" nowrap> </td>
365
<td class="md" valign="top"> ) </td>
366
<td class="md" nowrap> const</td>
372
<table cellspacing="5" cellpadding="0" border="0">
380
Return the cipher mode.
385
<a class="anchor" name="a1a3f7287378c34d627540cab7a2bf01"></a><!-- doxytag: member="QCA::Cipher::padding" ref="a1a3f7287378c34d627540cab7a2bf01" args="() const " --><p>
386
<table class="mdTable" cellpadding="2" cellspacing="0">
389
<table cellpadding="0" cellspacing="0" border="0">
391
<td class="md" nowrap valign="top"><a class="el" href="classQCA_1_1Cipher.html#eafc444370fbd6d1457580da2f00c52b">Padding</a> QCA::Cipher::padding </td>
392
<td class="md" valign="top">( </td>
393
<td class="mdname1" valign="top" nowrap> </td>
394
<td class="md" valign="top"> ) </td>
395
<td class="md" nowrap> const</td>
401
<table cellspacing="5" cellpadding="0" border="0">
409
Return the cipher padding type.
414
<a class="anchor" name="cf1992168fae016c5f7531a4ee757de8"></a><!-- doxytag: member="QCA::Cipher::direction" ref="cf1992168fae016c5f7531a4ee757de8" args="() const " --><p>
415
<table class="mdTable" cellpadding="2" cellspacing="0">
418
<table cellpadding="0" cellspacing="0" border="0">
420
<td class="md" nowrap valign="top"><a class="el" href="namespaceQCA.html#8e5d1994b00ea69c9a598f93cd0990ce">Direction</a> QCA::Cipher::direction </td>
421
<td class="md" valign="top">( </td>
422
<td class="mdname1" valign="top" nowrap> </td>
423
<td class="md" valign="top"> ) </td>
424
<td class="md" nowrap> const</td>
430
<table cellspacing="5" cellpadding="0" border="0">
438
Return the cipher direction.
443
<a class="anchor" name="2a4e19ab0ea7d8fc52e9c3d2f84aab02"></a><!-- doxytag: member="QCA::Cipher::keyLength" ref="2a4e19ab0ea7d8fc52e9c3d2f84aab02" args="() const " --><p>
444
<table class="mdTable" cellpadding="2" cellspacing="0">
447
<table cellpadding="0" cellspacing="0" border="0">
449
<td class="md" nowrap valign="top"><a class="el" href="classQCA_1_1KeyLength.html">KeyLength</a> QCA::Cipher::keyLength </td>
450
<td class="md" valign="top">( </td>
451
<td class="mdname1" valign="top" nowrap> </td>
452
<td class="md" valign="top"> ) </td>
453
<td class="md" nowrap> const</td>
459
<table cellspacing="5" cellpadding="0" border="0">
467
Return acceptable key lengths.
472
<a class="anchor" name="1a0f3bb31878baceb8c9bd7718f2c3d6"></a><!-- doxytag: member="QCA::Cipher::validKeyLength" ref="1a0f3bb31878baceb8c9bd7718f2c3d6" args="(int n) const " --><p>
473
<table class="mdTable" cellpadding="2" cellspacing="0">
476
<table cellpadding="0" cellspacing="0" border="0">
478
<td class="md" nowrap valign="top">bool QCA::Cipher::validKeyLength </td>
479
<td class="md" valign="top">( </td>
480
<td class="md" nowrap valign="top">int </td>
481
<td class="mdname1" valign="top" nowrap> <em>n</em> </td>
482
<td class="md" valign="top"> ) </td>
483
<td class="md" nowrap> const</td>
489
<table cellspacing="5" cellpadding="0" border="0">
497
Test if a key length is valid for the cipher algorithm.
499
<dl compact><dt><b>Parameters:</b></dt><dd>
500
<table border="0" cellspacing="2" cellpadding="0">
501
<tr><td valign="top"></td><td valign="top"><em>n</em> </td><td>the key length in bytes </td></tr>
504
<dl compact><dt><b>Returns:</b></dt><dd>true if the key would be valid for the current algorithm </dd></dl>
508
<a class="anchor" name="c7d30a5ccf512e0625e307a10aebf6e1"></a><!-- doxytag: member="QCA::Cipher::blockSize" ref="c7d30a5ccf512e0625e307a10aebf6e1" args="() const " --><p>
509
<table class="mdTable" cellpadding="2" cellspacing="0">
512
<table cellpadding="0" cellspacing="0" border="0">
514
<td class="md" nowrap valign="top">int QCA::Cipher::blockSize </td>
515
<td class="md" valign="top">( </td>
516
<td class="mdname1" valign="top" nowrap> </td>
517
<td class="md" valign="top"> ) </td>
518
<td class="md" nowrap> const</td>
524
<table cellspacing="5" cellpadding="0" border="0">
532
return the block size for the cipher object
537
<a class="anchor" name="6c51f4e2583e779e3793113c2b397a4f"></a><!-- doxytag: member="QCA::Cipher::clear" ref="6c51f4e2583e779e3793113c2b397a4f" args="()" --><p>
538
<table class="mdTable" cellpadding="2" cellspacing="0">
541
<table cellpadding="0" cellspacing="0" border="0">
543
<td class="md" nowrap valign="top">virtual void QCA::Cipher::clear </td>
544
<td class="md" valign="top">( </td>
545
<td class="mdname1" valign="top" nowrap> </td>
546
<td class="md" valign="top"> ) </td>
547
<td class="md" nowrap><code> [virtual]</code></td>
553
<table cellspacing="5" cellpadding="0" border="0">
561
reset the cipher object, to allow re-use
565
Implements <a class="el" href="classQCA_1_1Filter.html#cacc47ad8763d534efc2629ed192edb4">QCA::Filter</a>. </td>
568
<a class="anchor" name="a730707a1fb3fef1f3d02b4afcfacab2"></a><!-- doxytag: member="QCA::Cipher::update" ref="a730707a1fb3fef1f3d02b4afcfacab2" args="(const MemoryRegion &a)" --><p>
569
<table class="mdTable" cellpadding="2" cellspacing="0">
572
<table cellpadding="0" cellspacing="0" border="0">
574
<td class="md" nowrap valign="top">virtual <a class="el" href="classQCA_1_1MemoryRegion.html">MemoryRegion</a> QCA::Cipher::update </td>
575
<td class="md" valign="top">( </td>
576
<td class="md" nowrap valign="top">const <a class="el" href="classQCA_1_1MemoryRegion.html">MemoryRegion</a> & </td>
577
<td class="mdname1" valign="top" nowrap> <em>a</em> </td>
578
<td class="md" valign="top"> ) </td>
579
<td class="md" nowrap><code> [virtual]</code></td>
585
<table cellspacing="5" cellpadding="0" border="0">
593
pass in a byte array of data, which will be encrypted or decrypted (according to the Direction that was set in the constructor or in <a class="el" href="classQCA_1_1Cipher.html#69b2257eeeacc4ff01166a45a662e8c7">setup()</a> ) and returned.
595
<dl compact><dt><b>Parameters:</b></dt><dd>
596
<table border="0" cellspacing="2" cellpadding="0">
597
<tr><td valign="top"></td><td valign="top"><em>a</em> </td><td>the array of data to encrypt / decrypt </td></tr>
602
Implements <a class="el" href="classQCA_1_1Filter.html#bb091f41a189df20ccdc53f25b022bab">QCA::Filter</a>.<dl compact><dt><b>Examples: </b></dt><dd>
603
<a class="el" href="ciphertest_8cpp-example.html#a58">ciphertest.cpp</a>.</dl> </td>
606
<a class="anchor" name="bdab1417eb8dc7e8dd16d94ce031b490"></a><!-- doxytag: member="QCA::Cipher::final" ref="bdab1417eb8dc7e8dd16d94ce031b490" args="()" --><p>
607
<table class="mdTable" cellpadding="2" cellspacing="0">
610
<table cellpadding="0" cellspacing="0" border="0">
612
<td class="md" nowrap valign="top">virtual <a class="el" href="classQCA_1_1MemoryRegion.html">MemoryRegion</a> QCA::Cipher::final </td>
613
<td class="md" valign="top">( </td>
614
<td class="mdname1" valign="top" nowrap> </td>
615
<td class="md" valign="top"> ) </td>
616
<td class="md" nowrap><code> [virtual]</code></td>
622
<table cellspacing="5" cellpadding="0" border="0">
630
complete the block of data, padding as required, and returning the completed block
634
Implements <a class="el" href="classQCA_1_1Filter.html#27dc17e4f60d4ebbe9d7c3310db8efa4">QCA::Filter</a>. </td>
637
<a class="anchor" name="12dae396f29a4241c13fb6f35489574f"></a><!-- doxytag: member="QCA::Cipher::ok" ref="12dae396f29a4241c13fb6f35489574f" args="() const " --><p>
638
<table class="mdTable" cellpadding="2" cellspacing="0">
641
<table cellpadding="0" cellspacing="0" border="0">
643
<td class="md" nowrap valign="top">virtual bool QCA::Cipher::ok </td>
644
<td class="md" valign="top">( </td>
645
<td class="mdname1" valign="top" nowrap> </td>
646
<td class="md" valign="top"> ) </td>
647
<td class="md" nowrap> const<code> [virtual]</code></td>
653
<table cellspacing="5" cellpadding="0" border="0">
661
Test if an <a class="el" href="classQCA_1_1Cipher.html#a730707a1fb3fef1f3d02b4afcfacab2">update()</a> or <a class="el" href="classQCA_1_1Cipher.html#bdab1417eb8dc7e8dd16d94ce031b490">final()</a> call succeeded.
663
<dl compact><dt><b>Returns:</b></dt><dd>true if the previous call succeeded </dd></dl>
666
Implements <a class="el" href="classQCA_1_1Filter.html#a0bd392d745b3086e2f82993bb55a896">QCA::Filter</a>.<dl compact><dt><b>Examples: </b></dt><dd>
667
<a class="el" href="ciphertest_8cpp-example.html#a59">ciphertest.cpp</a>.</dl> </td>
670
<a class="anchor" name="69b2257eeeacc4ff01166a45a662e8c7"></a><!-- doxytag: member="QCA::Cipher::setup" ref="69b2257eeeacc4ff01166a45a662e8c7" args="(Direction dir, const SymmetricKey &key, const InitializationVector &iv=InitializationVector())" --><p>
671
<table class="mdTable" cellpadding="2" cellspacing="0">
674
<table cellpadding="0" cellspacing="0" border="0">
676
<td class="md" nowrap valign="top">void QCA::Cipher::setup </td>
677
<td class="md" valign="top">( </td>
678
<td class="md" nowrap valign="top"><a class="el" href="namespaceQCA.html#8e5d1994b00ea69c9a598f93cd0990ce">Direction</a> </td>
679
<td class="mdname" nowrap> <em>dir</em>, </td>
682
<td class="md" nowrap align="right"></td>
684
<td class="md" nowrap>const <a class="el" href="classQCA_1_1SymmetricKey.html">SymmetricKey</a> & </td>
685
<td class="mdname" nowrap> <em>key</em>, </td>
688
<td class="md" nowrap align="right"></td>
690
<td class="md" nowrap>const <a class="el" href="classQCA_1_1InitializationVector.html">InitializationVector</a> & </td>
691
<td class="mdname" nowrap> <em>iv</em> = <code><a class="el" href="classQCA_1_1InitializationVector.html">InitializationVector</a>()</code></td>
695
<td class="md">) </td>
696
<td class="md" colspan="2"></td>
702
<table cellspacing="5" cellpadding="0" border="0">
710
Reset / reconfigure the <a class="el" href="classQCA_1_1Cipher.html">Cipher</a>.
712
You can use this to re-use an existing <a class="el" href="classQCA_1_1Cipher.html">Cipher</a>, rather than creating a new object with a slightly different configuration.<p>
713
<dl compact><dt><b>Parameters:</b></dt><dd>
714
<table border="0" cellspacing="2" cellpadding="0">
715
<tr><td valign="top"></td><td valign="top"><em>dir</em> </td><td>the Direction that this <a class="el" href="classQCA_1_1Cipher.html">Cipher</a> should use (Encode for encryption, Decode for decryption) </td></tr>
716
<tr><td valign="top"></td><td valign="top"><em>key</em> </td><td>the <a class="el" href="classQCA_1_1SymmetricKey.html">SymmetricKey</a> array that is the key </td></tr>
717
<tr><td valign="top"></td><td valign="top"><em>iv</em> </td><td>the <a class="el" href="classQCA_1_1InitializationVector.html">InitializationVector</a> to use </td></tr>
723
<a class="anchor" name="9be656582ff71957adbddf5ebabeb031"></a><!-- doxytag: member="QCA::Cipher::withAlgorithms" ref="9be656582ff71957adbddf5ebabeb031" args="(const QString &cipherType, Mode modeType, Padding paddingType)" --><p>
724
<table class="mdTable" cellpadding="2" cellspacing="0">
727
<table cellpadding="0" cellspacing="0" border="0">
729
<td class="md" nowrap valign="top">static <a class="elRef" doxygen="qt.tag:" href="qstring.html">QString</a> QCA::Cipher::withAlgorithms </td>
730
<td class="md" valign="top">( </td>
731
<td class="md" nowrap valign="top">const <a class="elRef" doxygen="qt.tag:" href="qstring.html">QString</a> & </td>
732
<td class="mdname" nowrap> <em>cipherType</em>, </td>
735
<td class="md" nowrap align="right"></td>
737
<td class="md" nowrap><a class="el" href="classQCA_1_1Cipher.html#55df34874dc7565d7de238d2d742d66b">Mode</a> </td>
738
<td class="mdname" nowrap> <em>modeType</em>, </td>
741
<td class="md" nowrap align="right"></td>
743
<td class="md" nowrap><a class="el" href="classQCA_1_1Cipher.html#eafc444370fbd6d1457580da2f00c52b">Padding</a> </td>
744
<td class="mdname" nowrap> <em>paddingType</em></td>
748
<td class="md">) </td>
749
<td class="md" colspan="2"><code> [static]</code></td>
755
<table cellspacing="5" cellpadding="0" border="0">
763
Construct a <a class="el" href="classQCA_1_1Cipher.html">Cipher</a> type string.
765
<dl compact><dt><b>Parameters:</b></dt><dd>
766
<table border="0" cellspacing="2" cellpadding="0">
767
<tr><td valign="top"></td><td valign="top"><em>cipherType</em> </td><td>the name of the algorithm (eg AES128, DES) </td></tr>
768
<tr><td valign="top"></td><td valign="top"><em>modeType</em> </td><td>the mode to operate the cipher in (eg QCA::CBC, QCA::CFB) </td></tr>
769
<tr><td valign="top"></td><td valign="top"><em>paddingType</em> </td><td>the padding required (eg QCA::NoPadding, QCA::PCKS7) </td></tr>
775
<hr>The documentation for this class was generated from the following file:<ul>
776
<li><a class="el" href="qca__basic_8h-source.html">qca_basic.h</a></ul>
777
<hr size="1"><address style="align: right;"><small>Generated on Fri Jul 6 13:23:19 2007 for Qt Cryptographic Architecture by
778
<a href="http://www.doxygen.org/index.html">
779
<img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.4.6 </small></address>