?? class_symmetric_cipher.html
字號:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=UTF-8"><title>Crypto++: SymmetricCipher Class Reference</title><link href="doxygen.css" rel="stylesheet" type="text/css"><link href="tabs.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.5.2 --><div class="tabs"> <ul> <li><a href="index.html"><span>Main Page</span></a></li> <li><a href="namespaces.html"><span>Namespaces</span></a></li> <li class="current"><a href="classes.html"><span>Classes</span></a></li> <li><a href="files.html"><span>Files</span></a></li> </ul></div><div class="tabs"> <ul> <li><a href="classes.html"><span>Alphabetical List</span></a></li> <li><a href="annotated.html"><span>Class List</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><h1>SymmetricCipher Class Reference</h1><!-- doxytag: class="SymmetricCipher" --><!-- doxytag: inherits="StreamTransformation,SimpleKeyingInterface" --><code>#include <<a class="el" href="cryptlib_8h-source.html">cryptlib.h</a>></code><p><p>Inheritance diagram for SymmetricCipher:<p><center><img src="class_symmetric_cipher.png" usemap="#SymmetricCipher_map" border="0" alt=""></center><map name="SymmetricCipher_map"><area href="class_stream_transformation.html" alt="StreamTransformation" shape="rect" coords="1319,112,1686,136"><area href="class_simple_keying_interface.html" alt="SimpleKeyingInterface" shape="rect" coords="1696,112,2063,136"><area href="class_algorithm.html" alt="Algorithm" shape="rect" coords="1319,56,1686,80"><area href="class_clonable.html" alt="Clonable" shape="rect" coords="1319,0,1686,24"><area href="class_cipher_mode_base.html" alt="CipherModeBase" shape="rect" coords="942,224,1309,248"><area href="class_weak1_1_1_a_r_c4___base.html" alt="Weak1::ARC4_Base" shape="rect" coords="2073,224,2440,248"><area href="class_block_oriented_cipher_mode_base.html" alt="BlockOrientedCipherModeBase" shape="rect" coords="377,280,744,304"><area href="class_mode_policy_common_template.html" alt="ModePolicyCommonTemplate< POLICY_INTERFACE >" shape="rect" coords="754,280,1121,304"><area href="class_mode_policy_common_template.html" alt="ModePolicyCommonTemplate< AdditiveCipherAbstractPolicy >" shape="rect" coords="1131,280,1498,304"><area href="class_mode_policy_common_template.html" alt="ModePolicyCommonTemplate< CFB_CipherAbstractPolicy >" shape="rect" coords="1696,280,2063,304"><area href="class_weak1_1_1_m_a_r_c4___base.html" alt="Weak1::MARC4_Base" shape="rect" coords="2073,280,2440,304"><area href="class_c_b_c___mode_base.html" alt="CBC_ModeBase" shape="rect" coords="188,336,555,360"><area href="class_e_c_b___one_way.html" alt="ECB_OneWay" shape="rect" coords="565,336,932,360"><area href="class_c_t_r___mode_policy.html" alt="CTR_ModePolicy" shape="rect" coords="942,336,1309,360"><area href="class_o_f_b___mode_policy.html" alt="OFB_ModePolicy" shape="rect" coords="1319,336,1686,360"><area href="class_c_f_b___mode_policy.html" alt="CFB_ModePolicy" shape="rect" coords="1696,336,2063,360"><area href="class_c_b_c___decryption.html" alt="CBC_Decryption" shape="rect" coords="0,392,367,416"><area href="class_c_b_c___encryption.html" alt="CBC_Encryption" shape="rect" coords="377,392,744,416"><area href="class_c_b_c___c_t_s___decryption.html" alt="CBC_CTS_Decryption" shape="rect" coords="0,448,367,472"><area href="class_c_b_c___c_t_s___encryption.html" alt="CBC_CTS_Encryption" shape="rect" coords="377,448,744,472"></map><a href="class_symmetric_cipher-members.html">List of all members.</a><hr><a name="_details"></a><h2>Detailed Description</h2>interface for one direction (encryption or decryption) of a stream cipher or cipher mode <p><p>Definition at line <a class="el" href="cryptlib_8h-source.html#l00608">608</a> of file <a class="el" href="cryptlib_8h-source.html">cryptlib.h</a>.<table border="0" cellpadding="0" cellspacing="0"><tr><td></td></tr><tr><td colspan="2"><br><h2>Public Types</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">enum </td><td class="memItemRight" valign="bottom"><a class="el" href="class_simple_keying_interface.html#88201c180fbfaa9fef2715252546ad6e">IV_Requirement</a> { <br> <a class="el" href="class_simple_keying_interface.html#88201c180fbfaa9fef2715252546ad6e1cc32e69fe4f385e54d9d482a2ab5a56">UNIQUE_IV</a> = 0, <a class="el" href="class_simple_keying_interface.html#88201c180fbfaa9fef2715252546ad6e4520c4379ee3a1aed95a36e2235ba338">RANDOM_IV</a>, <a class="el" href="class_simple_keying_interface.html#88201c180fbfaa9fef2715252546ad6eceff3ad4b12bcb6d7b61a5bd543a815c">UNPREDICTABLE_RANDOM_IV</a>, <a class="el" href="class_simple_keying_interface.html#88201c180fbfaa9fef2715252546ad6eb659bf6d2c470c50c14bfbab5b2d45ab">INTERNALLY_GENERATED_IV</a>, <br> <a class="el" href="class_simple_keying_interface.html#88201c180fbfaa9fef2715252546ad6ec1d24de3dedd05c28516f452d3ace417">NOT_RESYNCHRONIZABLE</a><br> }</td></tr><tr><td colspan="2"><br><h2>Public Member Functions</h2></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="el" href="class_stream_transformation.html">StreamTransformation</a> & </td><td class="memItemRight" valign="bottom"><a class="el" href="class_stream_transformation.html#8c9304fff5af593ee68d3cf0d33c06e9">Ref</a> ()</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">return a reference to this object, <a href="#8c9304fff5af593ee68d3cf0d33c06e9"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="e224d250f716e82c54bc4e4c8930d188"></a><!-- doxytag: member="SymmetricCipher::MandatoryBlockSize" ref="e224d250f716e82c54bc4e4c8930d188" args="() const" -->virtual unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_stream_transformation.html#e224d250f716e82c54bc4e4c8930d188">MandatoryBlockSize</a> () const</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">returns block size, if input must be processed in blocks, otherwise 1 <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_stream_transformation.html#f66ef64545279c01310718af3d627534">OptimalBlockSize</a> () const</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">returns the input block size that is most efficient for this cipher <a href="#f66ef64545279c01310718af3d627534"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b8422f6eee08fbc70069e222186e90de"></a><!-- doxytag: member="SymmetricCipher::GetOptimalBlockSizeUsed" ref="b8422f6eee08fbc70069e222186e90de" args="() const" -->virtual unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_stream_transformation.html#b8422f6eee08fbc70069e222186e90de">GetOptimalBlockSizeUsed</a> () const</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">returns how much of the current block is used up <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b9e603c24d02c4538b77b9d59f36310e"></a><!-- doxytag: member="SymmetricCipher::OptimalDataAlignment" ref="b9e603c24d02c4538b77b9d59f36310e" args="() const" -->virtual unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_stream_transformation.html#b9e603c24d02c4538b77b9d59f36310e">OptimalDataAlignment</a> () const</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">returns how input should be aligned for optimal performance <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_stream_transformation.html#26feabde21bc4d1783195969733e3bb0">ProcessData</a> (byte *outString, const byte *inString, size_t length)=0</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">encrypt or decrypt an array of bytes of specified length <a href="#26feabde21bc4d1783195969733e3bb0"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_stream_transformation.html#0668b78edaea082f87bf3e878c4c02f7">ProcessLastBlock</a> (byte *outString, const byte *inString, size_t length)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">for ciphers where the last block of data is special, encrypt or decrypt the last block of data <a href="#0668b78edaea082f87bf3e878c4c02f7"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="0b7c5bc41b9b5f6443ee32d65ebc044c"></a><!-- doxytag: member="SymmetricCipher::MinLastBlockSize" ref="0b7c5bc41b9b5f6443ee32d65ebc044c" args="() const" -->virtual unsigned int </td><td class="memItemRight" valign="bottom"><a class="el" href="class_stream_transformation.html#0b7c5bc41b9b5f6443ee32d65ebc044c">MinLastBlockSize</a> () const</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">returns the minimum size of the last block, 0 indicating the last block is not special <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c00f3fcc21f33f11c8efa4de67ff7774"></a><!-- doxytag: member="SymmetricCipher::ProcessString" ref="c00f3fcc21f33f11c8efa4de67ff7774" args="(byte *inoutString, size_t length)" -->void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_stream_transformation.html#c00f3fcc21f33f11c8efa4de67ff7774">ProcessString</a> (byte *inoutString, size_t length)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">same as ProcessData(inoutString, inoutString, length) <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="17951cb36412763e0d6bd9696177175d"></a><!-- doxytag: member="SymmetricCipher::ProcessString" ref="17951cb36412763e0d6bd9696177175d" args="(byte *outString, const byte *inString, size_t length)" -->void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_stream_transformation.html#17951cb36412763e0d6bd9696177175d">ProcessString</a> (byte *outString, const byte *inString, size_t length)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">same as ProcessData(outString, inString, length) <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="71a9bd33526fc7f227050075e7a78106"></a><!-- doxytag: member="SymmetricCipher::ProcessByte" ref="71a9bd33526fc7f227050075e7a78106" args="(byte input)" -->byte </td><td class="memItemRight" valign="bottom"><a class="el" href="class_stream_transformation.html#71a9bd33526fc7f227050075e7a78106">ProcessByte</a> (byte input)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">implemented as {ProcessData(&input, &input, 1); return input;} <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c97d3fcac9b9f596ac8a7c69b69524cf"></a><!-- doxytag: member="SymmetricCipher::IsRandomAccess" ref="c97d3fcac9b9f596ac8a7c69b69524cf" args="() const=0" -->virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_stream_transformation.html#c97d3fcac9b9f596ac8a7c69b69524cf">IsRandomAccess</a> () const=0</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">returns whether this cipher supports random access <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="7bfbac3f2e43b50d1e16e6b4b2d2e48a"></a><!-- doxytag: member="SymmetricCipher::Seek" ref="7bfbac3f2e43b50d1e16e6b4b2d2e48a" args="(lword n)" -->virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_stream_transformation.html#7bfbac3f2e43b50d1e16e6b4b2d2e48a">Seek</a> (lword n)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">for random access ciphers, seek to an absolute position <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="aad9b1fd9cceaf3641f03452da29534b"></a><!-- doxytag: member="SymmetricCipher::IsSelfInverting" ref="aad9b1fd9cceaf3641f03452da29534b" args="() const=0" -->virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_stream_transformation.html#aad9b1fd9cceaf3641f03452da29534b">IsSelfInverting</a> () const=0</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">returns whether this transformation is self-inverting (e.g. xor with a keystream) <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="548b24c9354ebda5cdd06ef1cd79667b"></a><!-- doxytag: member="SymmetricCipher::IsForwardTransformation" ref="548b24c9354ebda5cdd06ef1cd79667b" args="() const=0" -->virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_stream_transformation.html#548b24c9354ebda5cdd06ef1cd79667b">IsForwardTransformation</a> () const=0</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">returns whether this is an encryption object <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="4f31510a192d1121856efe8ad0a9b844"></a><!-- doxytag: member="SymmetricCipher::AlgorithmName" ref="4f31510a192d1121856efe8ad0a9b844" args="() const" -->virtual std::string </td><td class="memItemRight" valign="bottom"><a class="el" href="class_algorithm.html#4f31510a192d1121856efe8ad0a9b844">AlgorithmName</a> () const</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">returns name of this algorithm, not universally implemented yet <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d0016ba2d505c23aa85aad49e6c19bb7"></a><!-- doxytag: member="SymmetricCipher::Clone" ref="d0016ba2d505c23aa85aad49e6c19bb7" args="() const" -->virtual <a class="el" href="class_clonable.html">Clonable</a> * </td><td class="memItemRight" valign="bottom"><a class="el" href="class_clonable.html#d0016ba2d505c23aa85aad49e6c19bb7">Clone</a> () const</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">this is not implemented by most classes yet <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="b9e027a141d40929fef51343064d1a69"></a><!-- doxytag: member="SymmetricCipher::MinKeyLength" ref="b9e027a141d40929fef51343064d1a69" args="() const=0" -->virtual size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="class_simple_keying_interface.html#b9e027a141d40929fef51343064d1a69">MinKeyLength</a> () const=0</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">returns smallest valid key length in bytes */ <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="99ebc91e778d51d8481c4c4e8403508b"></a><!-- doxytag: member="SymmetricCipher::MaxKeyLength" ref="99ebc91e778d51d8481c4c4e8403508b" args="() const=0" -->virtual size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="class_simple_keying_interface.html#99ebc91e778d51d8481c4c4e8403508b">MaxKeyLength</a> () const=0</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">returns largest valid key length in bytes */ <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="f900bd0bce7f925cfe8c6002b828d810"></a><!-- doxytag: member="SymmetricCipher::DefaultKeyLength" ref="f900bd0bce7f925cfe8c6002b828d810" args="() const=0" -->virtual size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="class_simple_keying_interface.html#f900bd0bce7f925cfe8c6002b828d810">DefaultKeyLength</a> () const=0</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">returns default (recommended) key length in bytes */ <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="d4fb24fe36b6396c361d83dcc8c647f0"></a><!-- doxytag: member="SymmetricCipher::GetValidKeyLength" ref="d4fb24fe36b6396c361d83dcc8c647f0" args="(size_t n) const=0" -->virtual size_t </td><td class="memItemRight" valign="bottom"><a class="el" href="class_simple_keying_interface.html#d4fb24fe36b6396c361d83dcc8c647f0">GetValidKeyLength</a> (size_t n) const=0</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">returns the smallest valid key length in bytes that is >= min(n, GetMaxKeyLength()) <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="2229cdb9d7ac7e2cf3b02b39ae59ad77"></a><!-- doxytag: member="SymmetricCipher::IsValidKeyLength" ref="2229cdb9d7ac7e2cf3b02b39ae59ad77" args="(size_t n) const" -->virtual bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_simple_keying_interface.html#2229cdb9d7ac7e2cf3b02b39ae59ad77">IsValidKeyLength</a> (size_t n) const</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">returns whether n is a valid key length <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">virtual void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_simple_keying_interface.html#df3c29b3ef3af74788a58c7c49887fd7">SetKey</a> (const byte *key, size_t length, const <a class="el" href="class_name_value_pairs.html">NameValuePairs</a> &params=<a class="el" href="cryptlib_8h.html#d3205973dd1afa14090a683154c1109c">g_nullNameValuePairs</a>)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">set or reset the key of this object <a href="#df3c29b3ef3af74788a58c7c49887fd7"></a><br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="0401f9c67930805180964bc02ae0ac1c"></a><!-- doxytag: member="SymmetricCipher::SetKeyWithRounds" ref="0401f9c67930805180964bc02ae0ac1c" args="(const byte *key, size_t length, int rounds)" -->void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_simple_keying_interface.html#0401f9c67930805180964bc02ae0ac1c">SetKeyWithRounds</a> (const byte *key, size_t length, int rounds)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">calls <a class="el" href="class_simple_keying_interface.html#df3c29b3ef3af74788a58c7c49887fd7" title="set or reset the key of this object">SetKey()</a> with an <a class="el" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> object that just specifies "Rounds" <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="c25e27eaeae2e909741c07de93caef49"></a><!-- doxytag: member="SymmetricCipher::SetKeyWithIV" ref="c25e27eaeae2e909741c07de93caef49" args="(const byte *key, size_t length, const byte *iv)" -->void </td><td class="memItemRight" valign="bottom"><a class="el" href="class_simple_keying_interface.html#c25e27eaeae2e909741c07de93caef49">SetKeyWithIV</a> (const byte *key, size_t length, const byte *iv)</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">calls <a class="el" href="class_simple_keying_interface.html#df3c29b3ef3af74788a58c7c49887fd7" title="set or reset the key of this object">SetKey()</a> with an <a class="el" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> object that just specifies "IV" <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top"><a class="anchor" name="22087180aa396209403b0852e9efc431"></a><!-- doxytag: member="SymmetricCipher::IVRequirement" ref="22087180aa396209403b0852e9efc431" args="() const=0" -->virtual <a class="el" href="class_simple_keying_interface.html#88201c180fbfaa9fef2715252546ad6e">IV_Requirement</a> </td><td class="memItemRight" valign="bottom"><a class="el" href="class_simple_keying_interface.html#22087180aa396209403b0852e9efc431">IVRequirement</a> () const=0</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">returns the minimal requirement for secure IVs <br></td></tr><tr><td class="memItemLeft" nowrap align="right" valign="top">bool </td><td class="memItemRight" valign="bottom"><a class="el" href="class_simple_keying_interface.html#71039112353cc70e9859ebd95037cc1a">IsResynchronizable</a> () const</td></tr><tr><td class="mdescLeft"> </td><td class="mdescRight">returns whether this object can be resynchronized (i.e. supports initialization vectors) <a href="#71039112353cc70e9859ebd95037cc1a"></a><br></td></tr>
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -