Sophie

Sophie

distrib > Fedora > 13 > i386 > media > os > by-pkgid > 07dfcfe50d66c9a48a3c5e6c1693f12a > files > 1875

cryptopp-doc-5.6.1-0.1.svn479.fc13.i686.rpm

<!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"/>
<title>Crypto++: pubkey.h Source File</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<link href="doxygen.css" rel="stylesheet" type="text/css"/>
</head>
<body>
<!-- Generated by Doxygen 1.6.1 -->
<div class="navigation" id="top">
  <div class="tabs">
    <ul>
      <li><a href="index.html"><span>Main&nbsp;Page</span></a></li>
      <li><a href="namespaces.html"><span>Namespaces</span></a></li>
      <li><a href="annotated.html"><span>Classes</span></a></li>
      <li class="current"><a href="files.html"><span>Files</span></a></li>
    </ul>
  </div>
  <div class="tabs">
    <ul>
      <li><a href="files.html"><span>File&nbsp;List</span></a></li>
      <li><a href="globals.html"><span>File&nbsp;Members</span></a></li>
    </ul>
  </div>
<h1>pubkey.h</h1><a href="pubkey_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="comment">// pubkey.h - written and placed in the public domain by Wei Dai</span>
<a name="l00002"></a>00002 
<a name="l00003"></a>00003 <span class="preprocessor">#ifndef CRYPTOPP_PUBKEY_H</span>
<a name="l00004"></a>00004 <span class="preprocessor"></span><span class="preprocessor">#define CRYPTOPP_PUBKEY_H</span>
<a name="l00005"></a>00005 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00006"></a>00006 <span class="comment">/** \file</span>
<a name="l00007"></a>00007 <span class="comment"></span>
<a name="l00008"></a>00008 <span class="comment">        This file contains helper classes/functions for implementing public key algorithms.</span>
<a name="l00009"></a>00009 <span class="comment"></span>
<a name="l00010"></a>00010 <span class="comment">        The class hierachies in this .h file tend to look like this:</span>
<a name="l00011"></a>00011 <span class="comment">&lt;pre&gt;</span>
<a name="l00012"></a>00012 <span class="comment">                  x1</span>
<a name="l00013"></a>00013 <span class="comment">                 / \</span>
<a name="l00014"></a>00014 <span class="comment">                y1  z1</span>
<a name="l00015"></a>00015 <span class="comment">                 |  |</span>
<a name="l00016"></a>00016 <span class="comment">            x2&lt;y1&gt;  x2&lt;z1&gt;</span>
<a name="l00017"></a>00017 <span class="comment">                 |  |</span>
<a name="l00018"></a>00018 <span class="comment">                y2  z2</span>
<a name="l00019"></a>00019 <span class="comment">                 |  |</span>
<a name="l00020"></a>00020 <span class="comment">            x3&lt;y2&gt;  x3&lt;z2&gt;</span>
<a name="l00021"></a>00021 <span class="comment">                 |  |</span>
<a name="l00022"></a>00022 <span class="comment">                y3  z3</span>
<a name="l00023"></a>00023 <span class="comment">&lt;/pre&gt;</span>
<a name="l00024"></a>00024 <span class="comment">        - x1, y1, z1 are abstract interface classes defined in cryptlib.h</span>
<a name="l00025"></a>00025 <span class="comment">        - x2, y2, z2 are implementations of the interfaces using &quot;abstract policies&quot;, which</span>
<a name="l00026"></a>00026 <span class="comment">          are pure virtual functions that should return interfaces to interchangeable algorithms.</span>
<a name="l00027"></a>00027 <span class="comment">          These classes have &quot;Base&quot; suffixes.</span>
<a name="l00028"></a>00028 <span class="comment">        - x3, y3, z3 hold actual algorithms and implement those virtual functions.</span>
<a name="l00029"></a>00029 <span class="comment">          These classes have &quot;Impl&quot; suffixes.</span>
<a name="l00030"></a>00030 <span class="comment"></span>
<a name="l00031"></a>00031 <span class="comment">        The &quot;TF_&quot; prefix means an implementation using trapdoor functions on integers.</span>
<a name="l00032"></a>00032 <span class="comment">        The &quot;DL_&quot; prefix means an implementation using group operations (in groups where discrete log is hard).</span>
<a name="l00033"></a>00033 <span class="comment">*/</span>
<a name="l00034"></a>00034 
<a name="l00035"></a>00035 <span class="preprocessor">#include &quot;modarith.h&quot;</span>
<a name="l00036"></a>00036 <span class="preprocessor">#include &quot;filters.h&quot;</span>
<a name="l00037"></a>00037 <span class="preprocessor">#include &quot;eprecomp.h&quot;</span>
<a name="l00038"></a>00038 <span class="preprocessor">#include &quot;<a class="code" href="fips140_8h.html">fips140.h</a>&quot;</span>
<a name="l00039"></a>00039 <span class="preprocessor">#include &quot;argnames.h&quot;</span>
<a name="l00040"></a>00040 <span class="preprocessor">#include &lt;memory&gt;</span>
<a name="l00041"></a>00041 
<a name="l00042"></a>00042 <span class="comment">// VC60 workaround: this macro is defined in shlobj.h and conflicts with a template parameter used in this file</span>
<a name="l00043"></a>00043 <span class="preprocessor">#undef INTERFACE</span>
<a name="l00044"></a>00044 <span class="preprocessor"></span>
<a name="l00045"></a>00045 NAMESPACE_BEGIN(CryptoPP)
<a name="l00046"></a>00046 
<a name="l00047"></a>00047 <span class="comment">//! _</span>
<a name="l00048"></a><a class="code" href="class_trapdoor_function_bounds.html">00048</a> <span class="comment"></span>class CRYPTOPP_DLL CRYPTOPP_NO_VTABLE <a class="code" href="class_trapdoor_function_bounds.html" title="_">TrapdoorFunctionBounds</a>
<a name="l00049"></a>00049 {
<a name="l00050"></a>00050 <span class="keyword">public</span>:
<a name="l00051"></a>00051         <span class="keyword">virtual</span> ~TrapdoorFunctionBounds() {}
<a name="l00052"></a>00052 
<a name="l00053"></a>00053         <span class="keyword">virtual</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> PreimageBound() <span class="keyword">const</span> =0;
<a name="l00054"></a>00054         <span class="keyword">virtual</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> ImageBound() <span class="keyword">const</span> =0;
<a name="l00055"></a>00055         <span class="keyword">virtual</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> MaxPreimage()<span class="keyword"> const </span>{<span class="keywordflow">return</span> --PreimageBound();}
<a name="l00056"></a>00056         <span class="keyword">virtual</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> MaxImage()<span class="keyword"> const </span>{<span class="keywordflow">return</span> --ImageBound();}
<a name="l00057"></a>00057 };
<a name="l00058"></a>00058 <span class="comment"></span>
<a name="l00059"></a>00059 <span class="comment">//! _</span>
<a name="l00060"></a><a class="code" href="class_randomized_trapdoor_function.html">00060</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_DLL CRYPTOPP_NO_VTABLE <a class="code" href="class_randomized_trapdoor_function.html" title="_">RandomizedTrapdoorFunction</a> : <span class="keyword">public</span> <a class="code" href="class_trapdoor_function_bounds.html" title="_">TrapdoorFunctionBounds</a>
<a name="l00061"></a>00061 {
<a name="l00062"></a>00062 <span class="keyword">public</span>:
<a name="l00063"></a>00063         <span class="keyword">virtual</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> ApplyRandomizedFunction(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;x) <span class="keyword">const</span> =0;
<a name="l00064"></a>00064         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> IsRandomized()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <span class="keyword">true</span>;}
<a name="l00065"></a>00065 };
<a name="l00066"></a>00066 <span class="comment"></span>
<a name="l00067"></a>00067 <span class="comment">//! _</span>
<a name="l00068"></a><a class="code" href="class_trapdoor_function.html">00068</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_DLL CRYPTOPP_NO_VTABLE <a class="code" href="class_trapdoor_function.html" title="_">TrapdoorFunction</a> : <span class="keyword">public</span> <a class="code" href="class_randomized_trapdoor_function.html" title="_">RandomizedTrapdoorFunction</a>
<a name="l00069"></a>00069 {
<a name="l00070"></a>00070 <span class="keyword">public</span>:
<a name="l00071"></a>00071         <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> ApplyRandomizedFunction(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;x)<span class="keyword"> const</span>
<a name="l00072"></a>00072 <span class="keyword">                </span>{<span class="keywordflow">return</span> ApplyFunction(x);}
<a name="l00073"></a>00073         <span class="keywordtype">bool</span> IsRandomized()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <span class="keyword">false</span>;}
<a name="l00074"></a>00074 
<a name="l00075"></a>00075         <span class="keyword">virtual</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> ApplyFunction(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;x) <span class="keyword">const</span> =0;
<a name="l00076"></a>00076 };
<a name="l00077"></a>00077 <span class="comment"></span>
<a name="l00078"></a>00078 <span class="comment">//! _</span>
<a name="l00079"></a><a class="code" href="class_randomized_trapdoor_function_inverse.html">00079</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_DLL CRYPTOPP_NO_VTABLE <a class="code" href="class_randomized_trapdoor_function_inverse.html" title="_">RandomizedTrapdoorFunctionInverse</a>
<a name="l00080"></a>00080 {
<a name="l00081"></a>00081 <span class="keyword">public</span>:
<a name="l00082"></a>00082         <span class="keyword">virtual</span> ~<a class="code" href="class_randomized_trapdoor_function_inverse.html" title="_">RandomizedTrapdoorFunctionInverse</a>() {}
<a name="l00083"></a>00083 
<a name="l00084"></a>00084         <span class="keyword">virtual</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> CalculateRandomizedInverse(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;x) <span class="keyword">const</span> =0;
<a name="l00085"></a>00085         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> IsRandomized()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <span class="keyword">true</span>;}
<a name="l00086"></a>00086 };
<a name="l00087"></a>00087 <span class="comment"></span>
<a name="l00088"></a>00088 <span class="comment">//! _</span>
<a name="l00089"></a><a class="code" href="class_trapdoor_function_inverse.html">00089</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_DLL CRYPTOPP_NO_VTABLE <a class="code" href="class_trapdoor_function_inverse.html" title="_">TrapdoorFunctionInverse</a> : <span class="keyword">public</span> <a class="code" href="class_randomized_trapdoor_function_inverse.html" title="_">RandomizedTrapdoorFunctionInverse</a>
<a name="l00090"></a>00090 {
<a name="l00091"></a>00091 <span class="keyword">public</span>:
<a name="l00092"></a>00092         <span class="keyword">virtual</span> ~<a class="code" href="class_trapdoor_function_inverse.html" title="_">TrapdoorFunctionInverse</a>() {}
<a name="l00093"></a>00093 
<a name="l00094"></a>00094         <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> CalculateRandomizedInverse(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;x)<span class="keyword"> const</span>
<a name="l00095"></a>00095 <span class="keyword">                </span>{<span class="keywordflow">return</span> CalculateInverse(rng, x);}
<a name="l00096"></a>00096         <span class="keywordtype">bool</span> IsRandomized()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <span class="keyword">false</span>;}
<a name="l00097"></a>00097 
<a name="l00098"></a>00098         <span class="keyword">virtual</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> CalculateInverse(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;x) <span class="keyword">const</span> =0;
<a name="l00099"></a>00099 };
<a name="l00100"></a>00100 
<a name="l00101"></a>00101 <span class="comment">// ********************************************************</span>
<a name="l00102"></a>00102 <span class="comment"></span>
<a name="l00103"></a>00103 <span class="comment">//! message encoding method for public key encryption</span>
<a name="l00104"></a><a class="code" href="class_p_k___encryption_message_encoding_method.html">00104</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_p_k___encryption_message_encoding_method.html" title="message encoding method for public key encryption">PK_EncryptionMessageEncodingMethod</a>
<a name="l00105"></a>00105 {
<a name="l00106"></a>00106 <span class="keyword">public</span>:
<a name="l00107"></a>00107         <span class="keyword">virtual</span> ~<a class="code" href="class_p_k___encryption_message_encoding_method.html" title="message encoding method for public key encryption">PK_EncryptionMessageEncodingMethod</a>() {}
<a name="l00108"></a>00108 
<a name="l00109"></a>00109         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> ParameterSupported(<span class="keyword">const</span> <span class="keywordtype">char</span> *name)<span class="keyword"> const </span>{<span class="keywordflow">return</span> <span class="keyword">false</span>;}
<a name="l00110"></a>00110 <span class="comment"></span>
<a name="l00111"></a>00111 <span class="comment">        //! max size of unpadded message in bytes, given max size of padded message in bits (1 less than size of modulus)</span>
<a name="l00112"></a>00112 <span class="comment"></span>        <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> MaxUnpaddedLength(<span class="keywordtype">size_t</span> paddedLength) <span class="keyword">const</span> =0;
<a name="l00113"></a>00113 
<a name="l00114"></a>00114         <span class="keyword">virtual</span> <span class="keywordtype">void</span> Pad(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> byte *raw, <span class="keywordtype">size_t</span> inputLength, byte *padded, <span class="keywordtype">size_t</span> paddedBitLength, <span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;parameters) <span class="keyword">const</span> =0;
<a name="l00115"></a>00115 
<a name="l00116"></a>00116         <span class="keyword">virtual</span> <a class="code" href="struct_decoding_result.html" title="used to return decoding results">DecodingResult</a> Unpad(<span class="keyword">const</span> byte *padded, <span class="keywordtype">size_t</span> paddedBitLength, byte *raw, <span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;parameters) <span class="keyword">const</span> =0;
<a name="l00117"></a>00117 };
<a name="l00118"></a>00118 
<a name="l00119"></a>00119 <span class="comment">// ********************************************************</span>
<a name="l00120"></a>00120 <span class="comment"></span>
<a name="l00121"></a>00121 <span class="comment">//! _</span>
<a name="l00122"></a>00122 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> TFI, <span class="keyword">class</span> MEI&gt;
<a name="l00123"></a><a class="code" href="class_t_f___base.html">00123</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_t_f___base.html" title="_">TF_Base</a>
<a name="l00124"></a>00124 {
<a name="l00125"></a>00125 <span class="keyword">protected</span>:
<a name="l00126"></a>00126         <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="class_trapdoor_function_bounds.html" title="_">TrapdoorFunctionBounds</a> &amp; GetTrapdoorFunctionBounds() <span class="keyword">const</span> =0;
<a name="l00127"></a>00127 
<a name="l00128"></a>00128         <span class="keyword">typedef</span> TFI TrapdoorFunctionInterface;
<a name="l00129"></a>00129         <span class="keyword">virtual</span> <span class="keyword">const</span> TrapdoorFunctionInterface &amp; GetTrapdoorFunctionInterface() <span class="keyword">const</span> =0;
<a name="l00130"></a>00130 
<a name="l00131"></a>00131         <span class="keyword">typedef</span> MEI MessageEncodingInterface;
<a name="l00132"></a>00132         <span class="keyword">virtual</span> <span class="keyword">const</span> MessageEncodingInterface &amp; GetMessageEncodingInterface() <span class="keyword">const</span> =0;
<a name="l00133"></a>00133 };
<a name="l00134"></a>00134 
<a name="l00135"></a>00135 <span class="comment">// ********************************************************</span>
<a name="l00136"></a>00136 <span class="comment"></span>
<a name="l00137"></a>00137 <span class="comment">//! _</span>
<a name="l00138"></a>00138 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> BASE&gt;
<a name="l00139"></a><a class="code" href="class_p_k___fixed_length_crypto_system_impl.html">00139</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_p_k___fixed_length_crypto_system_impl.html" title="_">PK_FixedLengthCryptoSystemImpl</a> : <span class="keyword">public</span> <a class="code" href="class_b_a_s_e.html">BASE</a>
<a name="l00140"></a>00140 {
<a name="l00141"></a>00141 <span class="keyword">public</span>:
<a name="l00142"></a>00142         <span class="keywordtype">size_t</span> MaxPlaintextLength(<span class="keywordtype">size_t</span> ciphertextLength)<span class="keyword"> const</span>
<a name="l00143"></a>00143 <span class="keyword">                </span>{<span class="keywordflow">return</span> ciphertextLength == FixedCiphertextLength() ? FixedMaxPlaintextLength() : 0;}
<a name="l00144"></a>00144         <span class="keywordtype">size_t</span> CiphertextLength(<span class="keywordtype">size_t</span> plaintextLength)<span class="keyword"> const</span>
<a name="l00145"></a>00145 <span class="keyword">                </span>{<span class="keywordflow">return</span> plaintextLength &lt;= FixedMaxPlaintextLength() ? FixedCiphertextLength() : 0;}
<a name="l00146"></a>00146 
<a name="l00147"></a>00147         <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> FixedMaxPlaintextLength() <span class="keyword">const</span> =0;
<a name="l00148"></a>00148         <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> FixedCiphertextLength() <span class="keyword">const</span> =0;
<a name="l00149"></a>00149 };
<a name="l00150"></a>00150 <span class="comment"></span>
<a name="l00151"></a>00151 <span class="comment">//! _</span>
<a name="l00152"></a>00152 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> INTERFACE, <span class="keyword">class</span> BASE&gt;
<a name="l00153"></a><a class="code" href="class_t_f___crypto_system_base.html">00153</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_t_f___crypto_system_base.html" title="_">TF_CryptoSystemBase</a> : <span class="keyword">public</span> <a class="code" href="class_p_k___fixed_length_crypto_system_impl.html" title="_">PK_FixedLengthCryptoSystemImpl</a>&lt;INTERFACE&gt;, <span class="keyword">protected</span> <a class="code" href="class_b_a_s_e.html">BASE</a>
<a name="l00154"></a>00154 {
<a name="l00155"></a>00155 <span class="keyword">public</span>:
<a name="l00156"></a>00156         <span class="keywordtype">bool</span> ParameterSupported(<span class="keyword">const</span> <span class="keywordtype">char</span> *name)<span class="keyword"> const </span>{<span class="keywordflow">return</span> this-&gt;GetMessageEncodingInterface().ParameterSupported(name);}
<a name="l00157"></a>00157         <span class="keywordtype">size_t</span> FixedMaxPlaintextLength()<span class="keyword"> const </span>{<span class="keywordflow">return</span> this-&gt;GetMessageEncodingInterface().MaxUnpaddedLength(PaddedBlockBitLength());}
<a name="l00158"></a>00158         <span class="keywordtype">size_t</span> FixedCiphertextLength()<span class="keyword"> const </span>{<span class="keywordflow">return</span> this-&gt;GetTrapdoorFunctionBounds().MaxImage().ByteCount();}
<a name="l00159"></a>00159 
<a name="l00160"></a>00160 <span class="keyword">protected</span>:
<a name="l00161"></a>00161         <span class="keywordtype">size_t</span> PaddedBlockByteLength()<span class="keyword"> const </span>{<span class="keywordflow">return</span> BitsToBytes(PaddedBlockBitLength());}
<a name="l00162"></a>00162         <span class="keywordtype">size_t</span> PaddedBlockBitLength()<span class="keyword"> const </span>{<span class="keywordflow">return</span> this-&gt;GetTrapdoorFunctionBounds().PreimageBound().BitCount()-1;}
<a name="l00163"></a>00163 };
<a name="l00164"></a>00164 <span class="comment"></span>
<a name="l00165"></a>00165 <span class="comment">//! _</span>
<a name="l00166"></a><a class="code" href="class_t_f___decryptor_base.html">00166</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_DLL CRYPTOPP_NO_VTABLE <a class="code" href="class_t_f___decryptor_base.html" title="_">TF_DecryptorBase</a> : <span class="keyword">public</span> <a class="code" href="class_t_f___crypto_system_base.html" title="_">TF_CryptoSystemBase</a>&lt;PK_Decryptor, TF_Base&lt;TrapdoorFunctionInverse, PK_EncryptionMessageEncodingMethod&gt; &gt;
<a name="l00167"></a>00167 {
<a name="l00168"></a>00168 <span class="keyword">public</span>:
<a name="l00169"></a>00169         <a class="code" href="struct_decoding_result.html" title="used to return decoding results">DecodingResult</a> Decrypt(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> byte *ciphertext, <span class="keywordtype">size_t</span> ciphertextLength, byte *plaintext, <span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;parameters = g_nullNameValuePairs) <span class="keyword">const</span>;
<a name="l00170"></a>00170 };
<a name="l00171"></a>00171 <span class="comment"></span>
<a name="l00172"></a>00172 <span class="comment">//! _</span>
<a name="l00173"></a><a class="code" href="class_t_f___encryptor_base.html">00173</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_DLL CRYPTOPP_NO_VTABLE <a class="code" href="class_t_f___encryptor_base.html" title="_">TF_EncryptorBase</a> : <span class="keyword">public</span> <a class="code" href="class_t_f___crypto_system_base.html" title="_">TF_CryptoSystemBase</a>&lt;PK_Encryptor, TF_Base&lt;RandomizedTrapdoorFunction, PK_EncryptionMessageEncodingMethod&gt; &gt;
<a name="l00174"></a>00174 {
<a name="l00175"></a>00175 <span class="keyword">public</span>:
<a name="l00176"></a>00176         <span class="keywordtype">void</span> Encrypt(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> byte *plaintext, <span class="keywordtype">size_t</span> plaintextLength, byte *ciphertext, <span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;parameters = g_nullNameValuePairs) <span class="keyword">const</span>;
<a name="l00177"></a>00177 };
<a name="l00178"></a>00178 
<a name="l00179"></a>00179 <span class="comment">// ********************************************************</span>
<a name="l00180"></a>00180 
<a name="l00181"></a>00181 <span class="keyword">typedef</span> std::pair&lt;const byte *, size_t&gt; HashIdentifier;
<a name="l00182"></a>00182 <span class="comment"></span>
<a name="l00183"></a>00183 <span class="comment">//! interface for message encoding method for public key signature schemes</span>
<a name="l00184"></a><a class="code" href="class_p_k___signature_message_encoding_method.html">00184</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_p_k___signature_message_encoding_method.html" title="interface for message encoding method for public key signature schemes">PK_SignatureMessageEncodingMethod</a>
<a name="l00185"></a>00185 {
<a name="l00186"></a>00186 <span class="keyword">public</span>:
<a name="l00187"></a>00187         <span class="keyword">virtual</span> ~<a class="code" href="class_p_k___signature_message_encoding_method.html" title="interface for message encoding method for public key signature schemes">PK_SignatureMessageEncodingMethod</a>() {}
<a name="l00188"></a>00188 
<a name="l00189"></a>00189         <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> MinRepresentativeBitLength(<span class="keywordtype">size_t</span> hashIdentifierLength, <span class="keywordtype">size_t</span> digestLength)<span class="keyword"> const</span>
<a name="l00190"></a>00190 <span class="keyword">                </span>{<span class="keywordflow">return</span> 0;}
<a name="l00191"></a>00191         <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> MaxRecoverableLength(<span class="keywordtype">size_t</span> representativeBitLength, <span class="keywordtype">size_t</span> hashIdentifierLength, <span class="keywordtype">size_t</span> digestLength)<span class="keyword"> const</span>
<a name="l00192"></a>00192 <span class="keyword">                </span>{<span class="keywordflow">return</span> 0;}
<a name="l00193"></a>00193 
<a name="l00194"></a>00194         <span class="keywordtype">bool</span> IsProbabilistic()<span class="keyword"> const </span>
<a name="l00195"></a>00195 <span class="keyword">                </span>{<span class="keywordflow">return</span> <span class="keyword">true</span>;}
<a name="l00196"></a>00196         <span class="keywordtype">bool</span> AllowNonrecoverablePart()<span class="keyword"> const</span>
<a name="l00197"></a>00197 <span class="keyword">                </span>{<span class="keywordflow">throw</span> <a class="code" href="class_not_implemented.html" title="exception thrown by a class if a non-implemented method is called">NotImplemented</a>(<span class="stringliteral">&quot;PK_MessageEncodingMethod: this signature scheme does not support message recovery&quot;</span>);}
<a name="l00198"></a>00198         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> RecoverablePartFirst()<span class="keyword"> const</span>
<a name="l00199"></a>00199 <span class="keyword">                </span>{<span class="keywordflow">throw</span> <a class="code" href="class_not_implemented.html" title="exception thrown by a class if a non-implemented method is called">NotImplemented</a>(<span class="stringliteral">&quot;PK_MessageEncodingMethod: this signature scheme does not support message recovery&quot;</span>);}
<a name="l00200"></a>00200 
<a name="l00201"></a>00201         <span class="comment">// for verification, DL</span>
<a name="l00202"></a>00202         <span class="keyword">virtual</span> <span class="keywordtype">void</span> ProcessSemisignature(<a class="code" href="class_hash_transformation.html" title="interface for hash functions and data processing part of MACs">HashTransformation</a> &amp;hash, <span class="keyword">const</span> byte *semisignature, <span class="keywordtype">size_t</span> semisignatureLength)<span class="keyword"> const </span>{}
<a name="l00203"></a>00203 
<a name="l00204"></a>00204         <span class="comment">// for signature</span>
<a name="l00205"></a>00205         <span class="keyword">virtual</span> <span class="keywordtype">void</span> ProcessRecoverableMessage(<a class="code" href="class_hash_transformation.html" title="interface for hash functions and data processing part of MACs">HashTransformation</a> &amp;hash, 
<a name="l00206"></a>00206                 <span class="keyword">const</span> byte *recoverableMessage, <span class="keywordtype">size_t</span> recoverableMessageLength, 
<a name="l00207"></a>00207                 <span class="keyword">const</span> byte *presignature, <span class="keywordtype">size_t</span> presignatureLength,
<a name="l00208"></a>00208                 <a class="code" href="class_sec_block.html">SecByteBlock</a> &amp;semisignature)<span class="keyword"> const</span>
<a name="l00209"></a>00209 <span class="keyword">        </span>{
<a name="l00210"></a>00210                 <span class="keywordflow">if</span> (RecoverablePartFirst())
<a name="l00211"></a>00211                         assert(!<span class="stringliteral">&quot;ProcessRecoverableMessage() not implemented&quot;</span>);
<a name="l00212"></a>00212         }
<a name="l00213"></a>00213 
<a name="l00214"></a>00214         <span class="keyword">virtual</span> <span class="keywordtype">void</span> ComputeMessageRepresentative(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, 
<a name="l00215"></a>00215                 <span class="keyword">const</span> byte *recoverableMessage, <span class="keywordtype">size_t</span> recoverableMessageLength,
<a name="l00216"></a>00216                 <a class="code" href="class_hash_transformation.html" title="interface for hash functions and data processing part of MACs">HashTransformation</a> &amp;hash, HashIdentifier hashIdentifier, <span class="keywordtype">bool</span> messageEmpty,
<a name="l00217"></a>00217                 byte *representative, <span class="keywordtype">size_t</span> representativeBitLength) <span class="keyword">const</span> =0;
<a name="l00218"></a>00218 
<a name="l00219"></a>00219         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> VerifyMessageRepresentative(
<a name="l00220"></a>00220                 <a class="code" href="class_hash_transformation.html" title="interface for hash functions and data processing part of MACs">HashTransformation</a> &amp;hash, HashIdentifier hashIdentifier, <span class="keywordtype">bool</span> messageEmpty,
<a name="l00221"></a>00221                 byte *representative, <span class="keywordtype">size_t</span> representativeBitLength) <span class="keyword">const</span> =0;
<a name="l00222"></a>00222 
<a name="l00223"></a>00223         <span class="keyword">virtual</span> <a class="code" href="struct_decoding_result.html" title="used to return decoding results">DecodingResult</a> RecoverMessageFromRepresentative(        <span class="comment">// for TF</span>
<a name="l00224"></a>00224                 <a class="code" href="class_hash_transformation.html" title="interface for hash functions and data processing part of MACs">HashTransformation</a> &amp;hash, HashIdentifier hashIdentifier, <span class="keywordtype">bool</span> messageEmpty,
<a name="l00225"></a>00225                 byte *representative, <span class="keywordtype">size_t</span> representativeBitLength,
<a name="l00226"></a>00226                 byte *recoveredMessage)<span class="keyword"> const</span>
<a name="l00227"></a>00227 <span class="keyword">                </span>{<span class="keywordflow">throw</span> <a class="code" href="class_not_implemented.html" title="exception thrown by a class if a non-implemented method is called">NotImplemented</a>(<span class="stringliteral">&quot;PK_MessageEncodingMethod: this signature scheme does not support message recovery&quot;</span>);}
<a name="l00228"></a>00228 
<a name="l00229"></a>00229         <span class="keyword">virtual</span> <a class="code" href="struct_decoding_result.html" title="used to return decoding results">DecodingResult</a> RecoverMessageFromSemisignature(         <span class="comment">// for DL</span>
<a name="l00230"></a>00230                 <a class="code" href="class_hash_transformation.html" title="interface for hash functions and data processing part of MACs">HashTransformation</a> &amp;hash, HashIdentifier hashIdentifier,
<a name="l00231"></a>00231                 <span class="keyword">const</span> byte *presignature, <span class="keywordtype">size_t</span> presignatureLength,
<a name="l00232"></a>00232                 <span class="keyword">const</span> byte *semisignature, <span class="keywordtype">size_t</span> semisignatureLength,
<a name="l00233"></a>00233                 byte *recoveredMessage)<span class="keyword"> const</span>
<a name="l00234"></a>00234 <span class="keyword">                </span>{<span class="keywordflow">throw</span> <a class="code" href="class_not_implemented.html" title="exception thrown by a class if a non-implemented method is called">NotImplemented</a>(<span class="stringliteral">&quot;PK_MessageEncodingMethod: this signature scheme does not support message recovery&quot;</span>);}
<a name="l00235"></a>00235 
<a name="l00236"></a>00236         <span class="comment">// VC60 workaround</span>
<a name="l00237"></a><a class="code" href="struct_p_k___signature_message_encoding_method_1_1_hash_identifier_lookup.html">00237</a>         <span class="keyword">struct </span><a class="code" href="struct_p_k___signature_message_encoding_method_1_1_hash_identifier_lookup.html">HashIdentifierLookup</a>
<a name="l00238"></a>00238         {
<a name="l00239"></a><a class="code" href="struct_p_k___signature_message_encoding_method_1_1_hash_identifier_lookup_1_1_hash_identifier_lookup2.html">00239</a>                 <span class="keyword">template</span> &lt;<span class="keyword">class</span> H&gt; <span class="keyword">struct </span><a class="code" href="struct_p_k___signature_message_encoding_method_1_1_hash_identifier_lookup_1_1_hash_identifier_lookup2.html">HashIdentifierLookup2</a>
<a name="l00240"></a>00240                 {
<a name="l00241"></a>00241                         <span class="keyword">static</span> HashIdentifier CRYPTOPP_API Lookup()
<a name="l00242"></a>00242                         {
<a name="l00243"></a>00243                                 <span class="keywordflow">return</span> HashIdentifier(NULL, 0);
<a name="l00244"></a>00244                         }
<a name="l00245"></a>00245                 };
<a name="l00246"></a>00246         };
<a name="l00247"></a>00247 };
<a name="l00248"></a>00248 
<a name="l00249"></a><a class="code" href="class_p_k___deterministic_signature_message_encoding_method.html">00249</a> <span class="keyword">class </span>CRYPTOPP_DLL CRYPTOPP_NO_VTABLE <a class="code" href="class_p_k___deterministic_signature_message_encoding_method.html">PK_DeterministicSignatureMessageEncodingMethod</a> : <span class="keyword">public</span> <a class="code" href="class_p_k___signature_message_encoding_method.html" title="interface for message encoding method for public key signature schemes">PK_SignatureMessageEncodingMethod</a>
<a name="l00250"></a>00250 {
<a name="l00251"></a>00251 <span class="keyword">public</span>:
<a name="l00252"></a>00252         <span class="keywordtype">bool</span> VerifyMessageRepresentative(
<a name="l00253"></a>00253                 <a class="code" href="class_hash_transformation.html" title="interface for hash functions and data processing part of MACs">HashTransformation</a> &amp;hash, HashIdentifier hashIdentifier, <span class="keywordtype">bool</span> messageEmpty,
<a name="l00254"></a>00254                 byte *representative, <span class="keywordtype">size_t</span> representativeBitLength) <span class="keyword">const</span>;
<a name="l00255"></a>00255 };
<a name="l00256"></a>00256 
<a name="l00257"></a><a class="code" href="class_p_k___recoverable_signature_message_encoding_method.html">00257</a> <span class="keyword">class </span>CRYPTOPP_DLL CRYPTOPP_NO_VTABLE <a class="code" href="class_p_k___recoverable_signature_message_encoding_method.html">PK_RecoverableSignatureMessageEncodingMethod</a> : <span class="keyword">public</span> <a class="code" href="class_p_k___signature_message_encoding_method.html" title="interface for message encoding method for public key signature schemes">PK_SignatureMessageEncodingMethod</a>
<a name="l00258"></a>00258 {
<a name="l00259"></a>00259 <span class="keyword">public</span>:
<a name="l00260"></a>00260         <span class="keywordtype">bool</span> VerifyMessageRepresentative(
<a name="l00261"></a>00261                 <a class="code" href="class_hash_transformation.html" title="interface for hash functions and data processing part of MACs">HashTransformation</a> &amp;hash, HashIdentifier hashIdentifier, <span class="keywordtype">bool</span> messageEmpty,
<a name="l00262"></a>00262                 byte *representative, <span class="keywordtype">size_t</span> representativeBitLength) <span class="keyword">const</span>;
<a name="l00263"></a>00263 };
<a name="l00264"></a>00264 
<a name="l00265"></a><a class="code" href="class_d_l___signature_message_encoding_method___d_s_a.html">00265</a> <span class="keyword">class </span>CRYPTOPP_DLL <a class="code" href="class_d_l___signature_message_encoding_method___d_s_a.html">DL_SignatureMessageEncodingMethod_DSA</a> : <span class="keyword">public</span> <a class="code" href="class_p_k___deterministic_signature_message_encoding_method.html">PK_DeterministicSignatureMessageEncodingMethod</a>
<a name="l00266"></a>00266 {
<a name="l00267"></a>00267 <span class="keyword">public</span>:
<a name="l00268"></a>00268         <span class="keywordtype">void</span> ComputeMessageRepresentative(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, 
<a name="l00269"></a>00269                 <span class="keyword">const</span> byte *recoverableMessage, <span class="keywordtype">size_t</span> recoverableMessageLength,
<a name="l00270"></a>00270                 <a class="code" href="class_hash_transformation.html" title="interface for hash functions and data processing part of MACs">HashTransformation</a> &amp;hash, HashIdentifier hashIdentifier, <span class="keywordtype">bool</span> messageEmpty,
<a name="l00271"></a>00271                 byte *representative, <span class="keywordtype">size_t</span> representativeBitLength) <span class="keyword">const</span>;
<a name="l00272"></a>00272 };
<a name="l00273"></a>00273 
<a name="l00274"></a><a class="code" href="class_d_l___signature_message_encoding_method___n_r.html">00274</a> <span class="keyword">class </span>CRYPTOPP_DLL <a class="code" href="class_d_l___signature_message_encoding_method___n_r.html">DL_SignatureMessageEncodingMethod_NR</a> : <span class="keyword">public</span> <a class="code" href="class_p_k___deterministic_signature_message_encoding_method.html">PK_DeterministicSignatureMessageEncodingMethod</a>
<a name="l00275"></a>00275 {
<a name="l00276"></a>00276 <span class="keyword">public</span>:
<a name="l00277"></a>00277         <span class="keywordtype">void</span> ComputeMessageRepresentative(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, 
<a name="l00278"></a>00278                 <span class="keyword">const</span> byte *recoverableMessage, <span class="keywordtype">size_t</span> recoverableMessageLength,
<a name="l00279"></a>00279                 <a class="code" href="class_hash_transformation.html" title="interface for hash functions and data processing part of MACs">HashTransformation</a> &amp;hash, HashIdentifier hashIdentifier, <span class="keywordtype">bool</span> messageEmpty,
<a name="l00280"></a>00280                 byte *representative, <span class="keywordtype">size_t</span> representativeBitLength) <span class="keyword">const</span>;
<a name="l00281"></a>00281 };
<a name="l00282"></a>00282 
<a name="l00283"></a><a class="code" href="class_p_k___message_accumulator_base.html">00283</a> <span class="keyword">class </span>CRYPTOPP_DLL CRYPTOPP_NO_VTABLE <a class="code" href="class_p_k___message_accumulator_base.html">PK_MessageAccumulatorBase</a> : <span class="keyword">public</span> <a class="code" href="class_p_k___message_accumulator.html" title="interface for accumulating messages to be signed or verified">PK_MessageAccumulator</a>
<a name="l00284"></a>00284 {
<a name="l00285"></a>00285 <span class="keyword">public</span>:
<a name="l00286"></a>00286         <a class="code" href="class_p_k___message_accumulator_base.html">PK_MessageAccumulatorBase</a>() : m_empty(<span class="keyword">true</span>) {}
<a name="l00287"></a>00287 
<a name="l00288"></a>00288         <span class="keyword">virtual</span> <a class="code" href="class_hash_transformation.html" title="interface for hash functions and data processing part of MACs">HashTransformation</a> &amp; AccessHash() =0;
<a name="l00289"></a>00289 
<a name="l00290"></a><a class="code" href="class_p_k___message_accumulator_base.html#a4dbe89c39bb43b5ce822e6db13a0dd1f">00290</a>         <span class="keywordtype">void</span> <a class="code" href="class_hash_transformation.html#aafabefaf445b65d3ba0d8e1c0294afe5" title="process more input">Update</a>(<span class="keyword">const</span> byte *input, <span class="keywordtype">size_t</span> length)
<a name="l00291"></a>00291         {
<a name="l00292"></a>00292                 AccessHash().Update(input, length);
<a name="l00293"></a>00293                 m_empty = m_empty &amp;&amp; length == 0;
<a name="l00294"></a>00294         }
<a name="l00295"></a>00295 
<a name="l00296"></a>00296         <a class="code" href="class_sec_block.html" title="a block of memory allocated using A">SecByteBlock</a> m_recoverableMessage, m_representative, m_presignature, m_semisignature;
<a name="l00297"></a>00297         <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> m_k, m_s;
<a name="l00298"></a>00298         <span class="keywordtype">bool</span> m_empty;
<a name="l00299"></a>00299 };
<a name="l00300"></a>00300 
<a name="l00301"></a>00301 <span class="keyword">template</span> &lt;<span class="keyword">class</span> HASH_ALGORITHM&gt;
<a name="l00302"></a><a class="code" href="class_p_k___message_accumulator_impl.html">00302</a> <span class="keyword">class </span><a class="code" href="class_p_k___message_accumulator_impl.html">PK_MessageAccumulatorImpl</a> : <span class="keyword">public</span> <a class="code" href="class_p_k___message_accumulator_base.html">PK_MessageAccumulatorBase</a>, <span class="keyword">protected</span> <a class="code" href="class_object_holder.html">ObjectHolder</a>&lt;HASH_ALGORITHM&gt;
<a name="l00303"></a>00303 {
<a name="l00304"></a>00304 <span class="keyword">public</span>:
<a name="l00305"></a>00305         <a class="code" href="class_hash_transformation.html" title="interface for hash functions and data processing part of MACs">HashTransformation</a> &amp; AccessHash() {<span class="keywordflow">return</span> this-&gt;m_object;}
<a name="l00306"></a>00306 };
<a name="l00307"></a>00307 <span class="comment"></span>
<a name="l00308"></a>00308 <span class="comment">//! _</span>
<a name="l00309"></a>00309 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> INTERFACE, <span class="keyword">class</span> BASE&gt;
<a name="l00310"></a><a class="code" href="class_t_f___signature_scheme_base.html">00310</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_t_f___signature_scheme_base.html" title="_">TF_SignatureSchemeBase</a> : <span class="keyword">public</span> <a class="code" href="class_i_n_t_e_r_f_a_c_e.html">INTERFACE</a>, <span class="keyword">protected</span> <a class="code" href="class_b_a_s_e.html">BASE</a>
<a name="l00311"></a>00311 {
<a name="l00312"></a>00312 <span class="keyword">public</span>:
<a name="l00313"></a>00313         <span class="keywordtype">size_t</span> SignatureLength()<span class="keyword"> const </span>
<a name="l00314"></a>00314 <span class="keyword">                </span>{<span class="keywordflow">return</span> this-&gt;GetTrapdoorFunctionBounds().MaxPreimage().ByteCount();}
<a name="l00315"></a>00315         <span class="keywordtype">size_t</span> MaxRecoverableLength()<span class="keyword"> const </span>
<a name="l00316"></a>00316 <span class="keyword">                </span>{<span class="keywordflow">return</span> this-&gt;GetMessageEncodingInterface().MaxRecoverableLength(MessageRepresentativeBitLength(), GetHashIdentifier().second, GetDigestSize());}
<a name="l00317"></a>00317         <span class="keywordtype">size_t</span> MaxRecoverableLengthFromSignatureLength(<span class="keywordtype">size_t</span> signatureLength)<span class="keyword"> const</span>
<a name="l00318"></a>00318 <span class="keyword">                </span>{<span class="keywordflow">return</span> this-&gt;MaxRecoverableLength();}
<a name="l00319"></a>00319 
<a name="l00320"></a>00320         <span class="keywordtype">bool</span> IsProbabilistic()<span class="keyword"> const </span>
<a name="l00321"></a>00321 <span class="keyword">                </span>{<span class="keywordflow">return</span> this-&gt;GetTrapdoorFunctionInterface().IsRandomized() || this-&gt;GetMessageEncodingInterface().IsProbabilistic();}
<a name="l00322"></a>00322         <span class="keywordtype">bool</span> AllowNonrecoverablePart()<span class="keyword"> const </span>
<a name="l00323"></a>00323 <span class="keyword">                </span>{<span class="keywordflow">return</span> this-&gt;GetMessageEncodingInterface().AllowNonrecoverablePart();}
<a name="l00324"></a>00324         <span class="keywordtype">bool</span> RecoverablePartFirst()<span class="keyword"> const </span>
<a name="l00325"></a>00325 <span class="keyword">                </span>{<span class="keywordflow">return</span> this-&gt;GetMessageEncodingInterface().RecoverablePartFirst();}
<a name="l00326"></a>00326 
<a name="l00327"></a>00327 <span class="keyword">protected</span>:
<a name="l00328"></a>00328         <span class="keywordtype">size_t</span> MessageRepresentativeLength()<span class="keyword"> const </span>{<span class="keywordflow">return</span> BitsToBytes(MessageRepresentativeBitLength());}
<a name="l00329"></a>00329         <span class="keywordtype">size_t</span> MessageRepresentativeBitLength()<span class="keyword"> const </span>{<span class="keywordflow">return</span> this-&gt;GetTrapdoorFunctionBounds().ImageBound().BitCount()-1;}
<a name="l00330"></a>00330         <span class="keyword">virtual</span> HashIdentifier GetHashIdentifier() <span class="keyword">const</span> =0;
<a name="l00331"></a>00331         <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> GetDigestSize() <span class="keyword">const</span> =0;
<a name="l00332"></a>00332 };
<a name="l00333"></a>00333 <span class="comment"></span>
<a name="l00334"></a>00334 <span class="comment">//! _</span>
<a name="l00335"></a><a class="code" href="class_t_f___signer_base.html">00335</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_DLL CRYPTOPP_NO_VTABLE <a class="code" href="class_t_f___signer_base.html" title="_">TF_SignerBase</a> : <span class="keyword">public</span> <a class="code" href="class_t_f___signature_scheme_base.html" title="_">TF_SignatureSchemeBase</a>&lt;PK_Signer, TF_Base&lt;RandomizedTrapdoorFunctionInverse, PK_SignatureMessageEncodingMethod&gt; &gt;
<a name="l00336"></a>00336 {
<a name="l00337"></a>00337 <span class="keyword">public</span>:
<a name="l00338"></a>00338         <span class="keywordtype">void</span> InputRecoverableMessage(<a class="code" href="class_p_k___message_accumulator.html" title="interface for accumulating messages to be signed or verified">PK_MessageAccumulator</a> &amp;messageAccumulator, <span class="keyword">const</span> byte *recoverableMessage, <span class="keywordtype">size_t</span> recoverableMessageLength) <span class="keyword">const</span>;
<a name="l00339"></a>00339         <span class="keywordtype">size_t</span> SignAndRestart(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <a class="code" href="class_p_k___message_accumulator.html" title="interface for accumulating messages to be signed or verified">PK_MessageAccumulator</a> &amp;messageAccumulator, byte *signature, <span class="keywordtype">bool</span> restart=<span class="keyword">true</span>) <span class="keyword">const</span>;
<a name="l00340"></a>00340 };
<a name="l00341"></a>00341 <span class="comment"></span>
<a name="l00342"></a>00342 <span class="comment">//! _</span>
<a name="l00343"></a><a class="code" href="class_t_f___verifier_base.html">00343</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_DLL CRYPTOPP_NO_VTABLE <a class="code" href="class_t_f___verifier_base.html" title="_">TF_VerifierBase</a> : <span class="keyword">public</span> <a class="code" href="class_t_f___signature_scheme_base.html" title="_">TF_SignatureSchemeBase</a>&lt;PK_Verifier, TF_Base&lt;TrapdoorFunction, PK_SignatureMessageEncodingMethod&gt; &gt;
<a name="l00344"></a>00344 {
<a name="l00345"></a>00345 <span class="keyword">public</span>:
<a name="l00346"></a>00346         <span class="keywordtype">void</span> InputSignature(<a class="code" href="class_p_k___message_accumulator.html" title="interface for accumulating messages to be signed or verified">PK_MessageAccumulator</a> &amp;messageAccumulator, <span class="keyword">const</span> byte *signature, <span class="keywordtype">size_t</span> signatureLength) <span class="keyword">const</span>;
<a name="l00347"></a>00347         <span class="keywordtype">bool</span> VerifyAndRestart(<a class="code" href="class_p_k___message_accumulator.html" title="interface for accumulating messages to be signed or verified">PK_MessageAccumulator</a> &amp;messageAccumulator) <span class="keyword">const</span>;
<a name="l00348"></a>00348         <a class="code" href="struct_decoding_result.html" title="used to return decoding results">DecodingResult</a> RecoverAndRestart(byte *recoveredMessage, <a class="code" href="class_p_k___message_accumulator.html" title="interface for accumulating messages to be signed or verified">PK_MessageAccumulator</a> &amp;recoveryAccumulator) <span class="keyword">const</span>;
<a name="l00349"></a>00349 };
<a name="l00350"></a>00350 
<a name="l00351"></a>00351 <span class="comment">// ********************************************************</span>
<a name="l00352"></a>00352 <span class="comment"></span>
<a name="l00353"></a>00353 <span class="comment">//! _</span>
<a name="l00354"></a>00354 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3&gt;
<a name="l00355"></a><a class="code" href="struct_t_f___crypto_scheme_options.html">00355</a> <span class="keyword">struct </span><a class="code" href="struct_t_f___crypto_scheme_options.html" title="_">TF_CryptoSchemeOptions</a>
<a name="l00356"></a>00356 {
<a name="l00357"></a>00357         <span class="keyword">typedef</span> T1 AlgorithmInfo;
<a name="l00358"></a>00358         <span class="keyword">typedef</span> T2 Keys;
<a name="l00359"></a>00359         <span class="keyword">typedef</span> <span class="keyword">typename</span> Keys::PrivateKey <a class="code" href="class_private_key.html" title="interface for private keys">PrivateKey</a>;
<a name="l00360"></a>00360         <span class="keyword">typedef</span> <span class="keyword">typename</span> Keys::PublicKey <a class="code" href="class_public_key.html" title="interface for public keys">PublicKey</a>;
<a name="l00361"></a>00361         <span class="keyword">typedef</span> T3 MessageEncodingMethod;
<a name="l00362"></a>00362 };
<a name="l00363"></a>00363 <span class="comment"></span>
<a name="l00364"></a>00364 <span class="comment">//! _</span>
<a name="l00365"></a>00365 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3, <span class="keyword">class</span> T4&gt;
<a name="l00366"></a><a class="code" href="struct_t_f___signature_scheme_options.html">00366</a> <span class="keyword">struct </span><a class="code" href="struct_t_f___signature_scheme_options.html" title="_">TF_SignatureSchemeOptions</a> : <span class="keyword">public</span> <a class="code" href="struct_t_f___crypto_scheme_options.html" title="_">TF_CryptoSchemeOptions</a>&lt;T1, T2, T3&gt;
<a name="l00367"></a>00367 {
<a name="l00368"></a>00368         <span class="keyword">typedef</span> T4 <a class="code" href="class_hash_transformation.html" title="interface for hash functions and data processing part of MACs">HashFunction</a>;
<a name="l00369"></a>00369 };
<a name="l00370"></a>00370 <span class="comment"></span>
<a name="l00371"></a>00371 <span class="comment">//! _</span>
<a name="l00372"></a>00372 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> BASE, <span class="keyword">class</span> SCHEME_OPTIONS, <span class="keyword">class</span> KEY_CLASS&gt;
<a name="l00373"></a><a class="code" href="class_t_f___object_impl_base.html">00373</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_t_f___object_impl_base.html" title="_">TF_ObjectImplBase</a> : <span class="keyword">public</span> <a class="code" href="class_algorithm_impl.html" title="_">AlgorithmImpl</a>&lt;BASE, typename SCHEME_OPTIONS::AlgorithmInfo&gt;
<a name="l00374"></a>00374 {
<a name="l00375"></a>00375 <span class="keyword">public</span>:
<a name="l00376"></a>00376         <span class="keyword">typedef</span> SCHEME_OPTIONS SchemeOptions;
<a name="l00377"></a>00377         <span class="keyword">typedef</span> KEY_CLASS KeyClass;
<a name="l00378"></a>00378 
<a name="l00379"></a>00379         <a class="code" href="class_public_key.html" title="interface for public keys">PublicKey</a> &amp; AccessPublicKey() {<span class="keywordflow">return</span> AccessKey();}
<a name="l00380"></a>00380         <span class="keyword">const</span> <a class="code" href="class_public_key.html" title="interface for public keys">PublicKey</a> &amp; GetPublicKey()<span class="keyword"> const </span>{<span class="keywordflow">return</span> GetKey();}
<a name="l00381"></a>00381 
<a name="l00382"></a>00382         <a class="code" href="class_private_key.html" title="interface for private keys">PrivateKey</a> &amp; AccessPrivateKey() {<span class="keywordflow">return</span> AccessKey();}
<a name="l00383"></a>00383         <span class="keyword">const</span> <a class="code" href="class_private_key.html" title="interface for private keys">PrivateKey</a> &amp; GetPrivateKey()<span class="keyword"> const </span>{<span class="keywordflow">return</span> GetKey();}
<a name="l00384"></a>00384 
<a name="l00385"></a>00385         <span class="keyword">virtual</span> <span class="keyword">const</span> KeyClass &amp; GetKey() <span class="keyword">const</span> =0;
<a name="l00386"></a>00386         <span class="keyword">virtual</span> KeyClass &amp; AccessKey() =0;
<a name="l00387"></a>00387 
<a name="l00388"></a>00388         <span class="keyword">const</span> KeyClass &amp; GetTrapdoorFunction()<span class="keyword"> const </span>{<span class="keywordflow">return</span> GetKey();}
<a name="l00389"></a>00389 
<a name="l00390"></a>00390         <a class="code" href="class_p_k___message_accumulator.html" title="interface for accumulating messages to be signed or verified">PK_MessageAccumulator</a> * NewSignatureAccumulator(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng)<span class="keyword"> const</span>
<a name="l00391"></a>00391 <span class="keyword">        </span>{
<a name="l00392"></a>00392                 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="class_p_k___message_accumulator_impl.html">PK_MessageAccumulatorImpl&lt;CPP_TYPENAME SCHEME_OPTIONS::HashFunction&gt;</a>;
<a name="l00393"></a>00393         }
<a name="l00394"></a>00394         <a class="code" href="class_p_k___message_accumulator.html" title="interface for accumulating messages to be signed or verified">PK_MessageAccumulator</a> * NewVerificationAccumulator()<span class="keyword"> const</span>
<a name="l00395"></a>00395 <span class="keyword">        </span>{
<a name="l00396"></a>00396                 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="class_p_k___message_accumulator_impl.html">PK_MessageAccumulatorImpl&lt;CPP_TYPENAME SCHEME_OPTIONS::HashFunction&gt;</a>;
<a name="l00397"></a>00397         }
<a name="l00398"></a>00398 
<a name="l00399"></a>00399 <span class="keyword">protected</span>:
<a name="l00400"></a>00400         <span class="keyword">const</span> <span class="keyword">typename</span> BASE::MessageEncodingInterface &amp; GetMessageEncodingInterface()<span class="keyword"> const </span>
<a name="l00401"></a>00401 <span class="keyword">                </span>{<span class="keywordflow">return</span> <a class="code" href="class_singleton.html">Singleton&lt;CPP_TYPENAME SCHEME_OPTIONS::MessageEncodingMethod&gt;</a>().Ref();}
<a name="l00402"></a>00402         <span class="keyword">const</span> <a class="code" href="class_trapdoor_function_bounds.html" title="_">TrapdoorFunctionBounds</a> &amp; GetTrapdoorFunctionBounds()<span class="keyword"> const </span>
<a name="l00403"></a>00403 <span class="keyword">                </span>{<span class="keywordflow">return</span> GetKey();}
<a name="l00404"></a>00404         <span class="keyword">const</span> <span class="keyword">typename</span> BASE::TrapdoorFunctionInterface &amp; GetTrapdoorFunctionInterface()<span class="keyword"> const </span>
<a name="l00405"></a>00405 <span class="keyword">                </span>{<span class="keywordflow">return</span> GetKey();}
<a name="l00406"></a>00406 
<a name="l00407"></a>00407         <span class="comment">// for signature scheme</span>
<a name="l00408"></a>00408         HashIdentifier GetHashIdentifier()<span class="keyword"> const</span>
<a name="l00409"></a>00409 <span class="keyword">        </span>{
<a name="l00410"></a>00410         <span class="keyword">typedef</span> CPP_TYPENAME SchemeOptions::MessageEncodingMethod::HashIdentifierLookup::template HashIdentifierLookup2&lt;CPP_TYPENAME SchemeOptions::HashFunction&gt; L;
<a name="l00411"></a>00411         <span class="keywordflow">return</span> L::Lookup();
<a name="l00412"></a>00412         }
<a name="l00413"></a>00413         <span class="keywordtype">size_t</span> GetDigestSize()<span class="keyword"> const</span>
<a name="l00414"></a>00414 <span class="keyword">        </span>{
<a name="l00415"></a>00415                 <span class="keyword">typedef</span> CPP_TYPENAME SchemeOptions::HashFunction H;
<a name="l00416"></a>00416                 <span class="keywordflow">return</span> H::DIGESTSIZE;
<a name="l00417"></a>00417         }
<a name="l00418"></a>00418 };
<a name="l00419"></a>00419 <span class="comment"></span>
<a name="l00420"></a>00420 <span class="comment">//! _</span>
<a name="l00421"></a>00421 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> BASE, <span class="keyword">class</span> SCHEME_OPTIONS, <span class="keyword">class</span> KEY&gt;
<a name="l00422"></a><a class="code" href="class_t_f___object_impl_ext_ref.html">00422</a> <span class="keyword">class </span><a class="code" href="class_t_f___object_impl_ext_ref.html" title="_">TF_ObjectImplExtRef</a> : <span class="keyword">public</span> <a class="code" href="class_t_f___object_impl_base.html" title="_">TF_ObjectImplBase</a>&lt;BASE, SCHEME_OPTIONS, KEY&gt;
<a name="l00423"></a>00423 {
<a name="l00424"></a>00424 <span class="keyword">public</span>:
<a name="l00425"></a>00425         <a class="code" href="class_t_f___object_impl_ext_ref.html" title="_">TF_ObjectImplExtRef</a>(<span class="keyword">const</span> KEY *pKey = NULL) : m_pKey(pKey) {}
<a name="l00426"></a>00426         <span class="keywordtype">void</span> SetKeyPtr(<span class="keyword">const</span> KEY *pKey) {m_pKey = pKey;}
<a name="l00427"></a>00427 
<a name="l00428"></a>00428         <span class="keyword">const</span> KEY &amp; GetKey()<span class="keyword"> const </span>{<span class="keywordflow">return</span> *m_pKey;}
<a name="l00429"></a>00429         KEY &amp; AccessKey() {<span class="keywordflow">throw</span> <a class="code" href="class_not_implemented.html" title="exception thrown by a class if a non-implemented method is called">NotImplemented</a>(<span class="stringliteral">&quot;TF_ObjectImplExtRef: cannot modify refererenced key&quot;</span>);}
<a name="l00430"></a>00430 
<a name="l00431"></a>00431 <span class="keyword">private</span>:
<a name="l00432"></a>00432         <span class="keyword">const</span> KEY * m_pKey;
<a name="l00433"></a>00433 };
<a name="l00434"></a>00434 <span class="comment"></span>
<a name="l00435"></a>00435 <span class="comment">//! _</span>
<a name="l00436"></a>00436 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> BASE, <span class="keyword">class</span> SCHEME_OPTIONS, <span class="keyword">class</span> KEY_CLASS&gt;
<a name="l00437"></a><a class="code" href="class_t_f___object_impl.html">00437</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_t_f___object_impl.html" title="_">TF_ObjectImpl</a> : <span class="keyword">public</span> <a class="code" href="class_t_f___object_impl_base.html" title="_">TF_ObjectImplBase</a>&lt;BASE, SCHEME_OPTIONS, KEY_CLASS&gt;
<a name="l00438"></a>00438 {
<a name="l00439"></a>00439 <span class="keyword">public</span>:
<a name="l00440"></a>00440         <span class="keyword">typedef</span> KEY_CLASS KeyClass;
<a name="l00441"></a>00441 
<a name="l00442"></a>00442         <span class="keyword">const</span> KeyClass &amp; GetKey()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_trapdoorFunction;}
<a name="l00443"></a>00443         KeyClass &amp; AccessKey() {<span class="keywordflow">return</span> m_trapdoorFunction;}
<a name="l00444"></a>00444 
<a name="l00445"></a>00445 <span class="keyword">private</span>:
<a name="l00446"></a>00446         KeyClass m_trapdoorFunction;
<a name="l00447"></a>00447 };
<a name="l00448"></a>00448 <span class="comment"></span>
<a name="l00449"></a>00449 <span class="comment">//! _</span>
<a name="l00450"></a>00450 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> SCHEME_OPTIONS&gt;
<a name="l00451"></a><a class="code" href="class_t_f___decryptor_impl.html">00451</a> <span class="keyword">class </span><a class="code" href="class_t_f___decryptor_impl.html" title="_">TF_DecryptorImpl</a> : <span class="keyword">public</span> <a class="code" href="class_t_f___object_impl.html" title="_">TF_ObjectImpl</a>&lt;TF_DecryptorBase, SCHEME_OPTIONS, typename SCHEME_OPTIONS::PrivateKey&gt;
<a name="l00452"></a>00452 {
<a name="l00453"></a>00453 };
<a name="l00454"></a>00454 <span class="comment"></span>
<a name="l00455"></a>00455 <span class="comment">//! _</span>
<a name="l00456"></a>00456 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> SCHEME_OPTIONS&gt;
<a name="l00457"></a><a class="code" href="class_t_f___encryptor_impl.html">00457</a> <span class="keyword">class </span><a class="code" href="class_t_f___encryptor_impl.html" title="_">TF_EncryptorImpl</a> : <span class="keyword">public</span> <a class="code" href="class_t_f___object_impl.html" title="_">TF_ObjectImpl</a>&lt;TF_EncryptorBase, SCHEME_OPTIONS, typename SCHEME_OPTIONS::PublicKey&gt;
<a name="l00458"></a>00458 {
<a name="l00459"></a>00459 };
<a name="l00460"></a>00460 <span class="comment"></span>
<a name="l00461"></a>00461 <span class="comment">//! _</span>
<a name="l00462"></a>00462 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> SCHEME_OPTIONS&gt;
<a name="l00463"></a><a class="code" href="class_t_f___signer_impl.html">00463</a> <span class="keyword">class </span><a class="code" href="class_t_f___signer_impl.html" title="_">TF_SignerImpl</a> : <span class="keyword">public</span> <a class="code" href="class_t_f___object_impl.html" title="_">TF_ObjectImpl</a>&lt;TF_SignerBase, SCHEME_OPTIONS, typename SCHEME_OPTIONS::PrivateKey&gt;
<a name="l00464"></a>00464 {
<a name="l00465"></a>00465 };
<a name="l00466"></a>00466 <span class="comment"></span>
<a name="l00467"></a>00467 <span class="comment">//! _</span>
<a name="l00468"></a>00468 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> SCHEME_OPTIONS&gt;
<a name="l00469"></a><a class="code" href="class_t_f___verifier_impl.html">00469</a> <span class="keyword">class </span><a class="code" href="class_t_f___verifier_impl.html" title="_">TF_VerifierImpl</a> : <span class="keyword">public</span> <a class="code" href="class_t_f___object_impl.html" title="_">TF_ObjectImpl</a>&lt;TF_VerifierBase, SCHEME_OPTIONS, typename SCHEME_OPTIONS::PublicKey&gt;
<a name="l00470"></a>00470 {
<a name="l00471"></a>00471 };
<a name="l00472"></a>00472 
<a name="l00473"></a>00473 <span class="comment">// ********************************************************</span>
<a name="l00474"></a>00474 <span class="comment"></span>
<a name="l00475"></a>00475 <span class="comment">//! _</span>
<a name="l00476"></a><a class="code" href="class_mask_generating_function.html">00476</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_mask_generating_function.html" title="_">MaskGeneratingFunction</a>
<a name="l00477"></a>00477 {
<a name="l00478"></a>00478 <span class="keyword">public</span>:
<a name="l00479"></a>00479         <span class="keyword">virtual</span> ~<a class="code" href="class_mask_generating_function.html" title="_">MaskGeneratingFunction</a>() {}
<a name="l00480"></a>00480         <span class="keyword">virtual</span> <span class="keywordtype">void</span> GenerateAndMask(<a class="code" href="class_hash_transformation.html" title="interface for hash functions and data processing part of MACs">HashTransformation</a> &amp;hash, byte *output, <span class="keywordtype">size_t</span> outputLength, <span class="keyword">const</span> byte *input, <span class="keywordtype">size_t</span> inputLength, <span class="keywordtype">bool</span> mask = <span class="keyword">true</span>) <span class="keyword">const</span> =0;
<a name="l00481"></a>00481 };
<a name="l00482"></a>00482 
<a name="l00483"></a>00483 CRYPTOPP_DLL <span class="keywordtype">void</span> CRYPTOPP_API P1363_MGF1KDF2_Common(<a class="code" href="class_hash_transformation.html" title="interface for hash functions and data processing part of MACs">HashTransformation</a> &amp;hash, byte *output, <span class="keywordtype">size_t</span> outputLength, <span class="keyword">const</span> byte *input, <span class="keywordtype">size_t</span> inputLength, <span class="keyword">const</span> byte *derivationParams, <span class="keywordtype">size_t</span> derivationParamsLength, <span class="keywordtype">bool</span> mask, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> counterStart);
<a name="l00484"></a>00484 <span class="comment"></span>
<a name="l00485"></a>00485 <span class="comment">//! _</span>
<a name="l00486"></a><a class="code" href="class_p1363___m_g_f1.html">00486</a> <span class="comment"></span><span class="keyword">class </span><a class="code" href="class_p1363___m_g_f1.html" title="_">P1363_MGF1</a> : <span class="keyword">public</span> <a class="code" href="class_mask_generating_function.html" title="_">MaskGeneratingFunction</a>
<a name="l00487"></a>00487 {
<a name="l00488"></a>00488 <span class="keyword">public</span>:
<a name="l00489"></a>00489         <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> * CRYPTOPP_API StaticAlgorithmName() {<span class="keywordflow">return</span> <span class="stringliteral">&quot;MGF1&quot;</span>;}
<a name="l00490"></a>00490         <span class="keywordtype">void</span> GenerateAndMask(<a class="code" href="class_hash_transformation.html" title="interface for hash functions and data processing part of MACs">HashTransformation</a> &amp;hash, byte *output, <span class="keywordtype">size_t</span> outputLength, <span class="keyword">const</span> byte *input, <span class="keywordtype">size_t</span> inputLength, <span class="keywordtype">bool</span> mask = <span class="keyword">true</span>)<span class="keyword"> const</span>
<a name="l00491"></a>00491 <span class="keyword">        </span>{
<a name="l00492"></a>00492                 P1363_MGF1KDF2_Common(hash, output, outputLength, input, inputLength, NULL, 0, mask, 0);
<a name="l00493"></a>00493         }
<a name="l00494"></a>00494 };
<a name="l00495"></a>00495 
<a name="l00496"></a>00496 <span class="comment">// ********************************************************</span>
<a name="l00497"></a>00497 <span class="comment"></span>
<a name="l00498"></a>00498 <span class="comment">//! _</span>
<a name="l00499"></a>00499 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> H&gt;
<a name="l00500"></a><a class="code" href="class_p1363___k_d_f2.html">00500</a> <span class="keyword">class </span><a class="code" href="class_p1363___k_d_f2.html" title="_">P1363_KDF2</a>
<a name="l00501"></a>00501 {
<a name="l00502"></a>00502 <span class="keyword">public</span>:
<a name="l00503"></a>00503         <span class="keyword">static</span> <span class="keywordtype">void</span> CRYPTOPP_API DeriveKey(byte *output, <span class="keywordtype">size_t</span> outputLength, <span class="keyword">const</span> byte *input, <span class="keywordtype">size_t</span> inputLength, <span class="keyword">const</span> byte *derivationParams, <span class="keywordtype">size_t</span> derivationParamsLength)
<a name="l00504"></a>00504         {
<a name="l00505"></a>00505                 H h;
<a name="l00506"></a>00506                 P1363_MGF1KDF2_Common(h, output, outputLength, input, inputLength, derivationParams, derivationParamsLength, <span class="keyword">false</span>, 1);
<a name="l00507"></a>00507         }
<a name="l00508"></a>00508 };
<a name="l00509"></a>00509 
<a name="l00510"></a>00510 <span class="comment">// ********************************************************</span>
<a name="l00511"></a>00511 <span class="comment"></span>
<a name="l00512"></a>00512 <span class="comment">//! to be thrown by DecodeElement and AgreeWithStaticPrivateKey</span>
<a name="l00513"></a><a class="code" href="class_d_l___bad_element.html">00513</a> <span class="comment"></span><span class="keyword">class </span><a class="code" href="class_d_l___bad_element.html" title="to be thrown by DecodeElement and AgreeWithStaticPrivateKey">DL_BadElement</a> : <span class="keyword">public</span> <a class="code" href="class_invalid_data_format.html" title="exception thrown when input data is received that doesn&amp;#39;t conform to expected...">InvalidDataFormat</a>
<a name="l00514"></a>00514 {
<a name="l00515"></a>00515 <span class="keyword">public</span>:
<a name="l00516"></a>00516         <a class="code" href="class_d_l___bad_element.html" title="to be thrown by DecodeElement and AgreeWithStaticPrivateKey">DL_BadElement</a>() : <a class="code" href="class_invalid_data_format.html" title="exception thrown when input data is received that doesn&amp;#39;t conform to expected...">InvalidDataFormat</a>(<span class="stringliteral">&quot;CryptoPP: invalid group element&quot;</span>) {}
<a name="l00517"></a>00517 };
<a name="l00518"></a>00518 <span class="comment"></span>
<a name="l00519"></a>00519 <span class="comment">//! interface for DL group parameters</span>
<a name="l00520"></a>00520 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00521"></a><a class="code" href="class_d_l___group_parameters.html">00521</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters</a> : <span class="keyword">public</span> <a class="code" href="class_crypto_parameters.html" title="interface for crypto prameters">CryptoParameters</a>
<a name="l00522"></a>00522 {
<a name="l00523"></a>00523         <span class="keyword">typedef</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;T&gt;</a> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">ThisClass</a>;
<a name="l00524"></a>00524         
<a name="l00525"></a>00525 <span class="keyword">public</span>:
<a name="l00526"></a>00526         <span class="keyword">typedef</span> T Element;
<a name="l00527"></a>00527 
<a name="l00528"></a>00528         <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters</a>() : m_validationLevel(0) {}
<a name="l00529"></a>00529 
<a name="l00530"></a>00530         <span class="comment">// CryptoMaterial</span>
<a name="l00531"></a><a class="code" href="class_d_l___group_parameters.html#aa2b615bc7ed3561914a27a8c456258aa">00531</a>         <span class="keywordtype">bool</span> <a class="code" href="class_crypto_material.html#aaa7d67d0c12712de0e33713c73f5b718" title="check this object for errors">Validate</a>(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> level)<span class="keyword"> const</span>
<a name="l00532"></a>00532 <span class="keyword">        </span>{
<a name="l00533"></a>00533                 <span class="keywordflow">if</span> (!GetBasePrecomputation().IsInitialized())
<a name="l00534"></a>00534                         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l00535"></a>00535 
<a name="l00536"></a>00536                 <span class="keywordflow">if</span> (m_validationLevel &gt; level)
<a name="l00537"></a>00537                         <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l00538"></a>00538 
<a name="l00539"></a>00539                 <span class="keywordtype">bool</span> pass = ValidateGroup(rng, level);
<a name="l00540"></a>00540                 pass = pass &amp;&amp; ValidateElement(level, GetSubgroupGenerator(), &amp;GetBasePrecomputation());
<a name="l00541"></a>00541 
<a name="l00542"></a>00542                 m_validationLevel = pass ? level+1 : 0;
<a name="l00543"></a>00543 
<a name="l00544"></a>00544                 <span class="keywordflow">return</span> pass;
<a name="l00545"></a>00545         }
<a name="l00546"></a>00546 
<a name="l00547"></a><a class="code" href="class_d_l___group_parameters.html#ae782187e2221e3dc0a00d49116ec7df5">00547</a>         <span class="keywordtype">bool</span> <a class="code" href="class_name_value_pairs.html#a9fc3f5c4480d53b8104c67ca7958e332" title="to be implemented by derived classes, users should use one of the above functions...">GetVoidValue</a>(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keyword">const</span> std::type_info &amp;valueType, <span class="keywordtype">void</span> *pValue)<span class="keyword"> const</span>
<a name="l00548"></a>00548 <span class="keyword">        </span>{
<a name="l00549"></a>00549                 <span class="keywordflow">return</span> GetValueHelper(<span class="keyword">this</span>, name, valueType, pValue)
<a name="l00550"></a>00550                         CRYPTOPP_GET_FUNCTION_ENTRY(SubgroupOrder)
<a name="l00551"></a>00551                         CRYPTOPP_GET_FUNCTION_ENTRY(SubgroupGenerator)
<a name="l00552"></a>00552                         ;
<a name="l00553"></a>00553         }
<a name="l00554"></a>00554 
<a name="l00555"></a><a class="code" href="class_d_l___group_parameters.html#a42a423fd9d31e77a1d36e7da66da12bb">00555</a>         <span class="keywordtype">bool</span> <a class="code" href="class_d_l___group_parameters.html#a42a423fd9d31e77a1d36e7da66da12bb">SupportsPrecomputation</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <span class="keyword">true</span>;}
<a name="l00556"></a>00556 
<a name="l00557"></a><a class="code" href="class_d_l___group_parameters.html#a5f04ae8b4d0b9410a046af1607fbbb6f">00557</a>         <span class="keywordtype">void</span> <a class="code" href="class_crypto_material.html#a39e512d2ea70d0e967db98c19994a7fd" title="do precomputation">Precompute</a>(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> precomputationStorage=16)
<a name="l00558"></a>00558         {
<a name="l00559"></a>00559                 AccessBasePrecomputation().Precompute(GetGroupPrecomputation(), GetSubgroupOrder().BitCount(), precomputationStorage);
<a name="l00560"></a>00560         }
<a name="l00561"></a>00561 
<a name="l00562"></a><a class="code" href="class_d_l___group_parameters.html#a9b8c93a87802ef09dc546a994c850697">00562</a>         <span class="keywordtype">void</span> <a class="code" href="class_crypto_material.html#a2911ebd9a28efa43dab71e5c12e2c90d" title="retrieve previously saved precomputation">LoadPrecomputation</a>(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;storedPrecomputation)
<a name="l00563"></a>00563         {
<a name="l00564"></a>00564                 AccessBasePrecomputation().Load(GetGroupPrecomputation(), storedPrecomputation);
<a name="l00565"></a>00565                 m_validationLevel = 0;
<a name="l00566"></a>00566         }
<a name="l00567"></a>00567 
<a name="l00568"></a><a class="code" href="class_d_l___group_parameters.html#a443eb0933235d77d09da6bc7da24c74c">00568</a>         <span class="keywordtype">void</span> <a class="code" href="class_crypto_material.html#a839d0f7f3e256b625caf6fd792925ad4" title="save precomputation for later use">SavePrecomputation</a>(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;storedPrecomputation)<span class="keyword"> const</span>
<a name="l00569"></a>00569 <span class="keyword">        </span>{
<a name="l00570"></a>00570                 GetBasePrecomputation().Save(GetGroupPrecomputation(), storedPrecomputation);
<a name="l00571"></a>00571         }
<a name="l00572"></a>00572 
<a name="l00573"></a>00573         <span class="comment">// non-inherited</span>
<a name="l00574"></a>00574         <span class="keyword">virtual</span> <span class="keyword">const</span> Element &amp; GetSubgroupGenerator()<span class="keyword"> const </span>{<span class="keywordflow">return</span> GetBasePrecomputation().GetBase(GetGroupPrecomputation());}
<a name="l00575"></a>00575         <span class="keyword">virtual</span> <span class="keywordtype">void</span> SetSubgroupGenerator(<span class="keyword">const</span> Element &amp;base) {AccessBasePrecomputation().SetBase(GetGroupPrecomputation(), base);}
<a name="l00576"></a>00576         <span class="keyword">virtual</span> Element ExponentiateBase(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;exponent)<span class="keyword"> const</span>
<a name="l00577"></a>00577 <span class="keyword">        </span>{
<a name="l00578"></a>00578                 <span class="keywordflow">return</span> GetBasePrecomputation().Exponentiate(GetGroupPrecomputation(), exponent);
<a name="l00579"></a>00579         }
<a name="l00580"></a>00580         <span class="keyword">virtual</span> Element ExponentiateElement(<span class="keyword">const</span> Element &amp;base, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;exponent)<span class="keyword"> const</span>
<a name="l00581"></a>00581 <span class="keyword">        </span>{
<a name="l00582"></a>00582                 Element result;
<a name="l00583"></a>00583                 SimultaneousExponentiate(&amp;result, base, &amp;exponent, 1);
<a name="l00584"></a>00584                 <span class="keywordflow">return</span> result;
<a name="l00585"></a>00585         }
<a name="l00586"></a>00586 
<a name="l00587"></a>00587         <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="class_d_l___group_precomputation.html">DL_GroupPrecomputation&lt;Element&gt;</a> &amp; GetGroupPrecomputation() <span class="keyword">const</span> =0;
<a name="l00588"></a>00588         <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="class_d_l___fixed_base_precomputation.html">DL_FixedBasePrecomputation&lt;Element&gt;</a> &amp; GetBasePrecomputation() <span class="keyword">const</span> =0;
<a name="l00589"></a>00589         <span class="keyword">virtual</span> <a class="code" href="class_d_l___fixed_base_precomputation.html">DL_FixedBasePrecomputation&lt;Element&gt;</a> &amp; AccessBasePrecomputation() =0;
<a name="l00590"></a>00590         <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp; GetSubgroupOrder() <span class="keyword">const</span> =0;    <span class="comment">// order of subgroup generated by base element</span>
<a name="l00591"></a>00591         <span class="keyword">virtual</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> GetMaxExponent() <span class="keyword">const</span> =0;
<a name="l00592"></a>00592         <span class="keyword">virtual</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> GetGroupOrder()<span class="keyword"> const </span>{<span class="keywordflow">return</span> GetSubgroupOrder()*GetCofactor();}        <span class="comment">// one of these two needs to be overriden</span>
<a name="l00593"></a>00593         <span class="keyword">virtual</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> GetCofactor()<span class="keyword"> const </span>{<span class="keywordflow">return</span> GetGroupOrder()/GetSubgroupOrder();}
<a name="l00594"></a>00594         <span class="keyword">virtual</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> GetEncodedElementSize(<span class="keywordtype">bool</span> reversible) <span class="keyword">const</span> =0;
<a name="l00595"></a>00595         <span class="keyword">virtual</span> <span class="keywordtype">void</span> EncodeElement(<span class="keywordtype">bool</span> reversible, <span class="keyword">const</span> Element &amp;element, byte *encoded) <span class="keyword">const</span> =0;
<a name="l00596"></a>00596         <span class="keyword">virtual</span> Element DecodeElement(<span class="keyword">const</span> byte *encoded, <span class="keywordtype">bool</span> checkForGroupMembership) <span class="keyword">const</span> =0;
<a name="l00597"></a>00597         <span class="keyword">virtual</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> ConvertElementToInteger(<span class="keyword">const</span> Element &amp;element) <span class="keyword">const</span> =0;
<a name="l00598"></a>00598         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> ValidateGroup(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> level) <span class="keyword">const</span> =0;
<a name="l00599"></a>00599         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> ValidateElement(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> level, <span class="keyword">const</span> Element &amp;element, <span class="keyword">const</span> <a class="code" href="class_d_l___fixed_base_precomputation.html">DL_FixedBasePrecomputation&lt;Element&gt;</a> *precomp) <span class="keyword">const</span> =0;
<a name="l00600"></a>00600         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> FastSubgroupCheckAvailable() <span class="keyword">const</span> =0;
<a name="l00601"></a>00601         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> IsIdentity(<span class="keyword">const</span> Element &amp;element) <span class="keyword">const</span> =0;
<a name="l00602"></a>00602         <span class="keyword">virtual</span> <span class="keywordtype">void</span> SimultaneousExponentiate(Element *results, <span class="keyword">const</span> Element &amp;base, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> *exponents, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> exponentsCount) <span class="keyword">const</span> =0;
<a name="l00603"></a>00603 
<a name="l00604"></a>00604 <span class="keyword">protected</span>:
<a name="l00605"></a>00605         <span class="keywordtype">void</span> ParametersChanged() {m_validationLevel = 0;}
<a name="l00606"></a>00606 
<a name="l00607"></a>00607 <span class="keyword">private</span>:
<a name="l00608"></a>00608         <span class="keyword">mutable</span> <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> m_validationLevel;
<a name="l00609"></a>00609 };
<a name="l00610"></a>00610 <span class="comment"></span>
<a name="l00611"></a>00611 <span class="comment">//! _</span>
<a name="l00612"></a>00612 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> GROUP_PRECOMP, <span class="keyword">class</span> BASE_PRECOMP = DL_FixedBasePrecomputationImpl&lt;CPP_TYPENAME GROUP_PRECOMP::Element&gt;, <span class="keyword">class</span> BASE = DL_GroupParameters&lt;CPP_TYPENAME GROUP_PRECOMP::Element&gt; &gt;
<a name="l00613"></a><a class="code" href="class_d_l___group_parameters_impl.html">00613</a> <span class="keyword">class </span><a class="code" href="class_d_l___group_parameters_impl.html" title="_">DL_GroupParametersImpl</a> : <span class="keyword">public</span> <a class="code" href="class_b_a_s_e.html">BASE</a>
<a name="l00614"></a>00614 {
<a name="l00615"></a>00615 <span class="keyword">public</span>:
<a name="l00616"></a>00616         <span class="keyword">typedef</span> GROUP_PRECOMP GroupPrecomputation;
<a name="l00617"></a>00617         <span class="keyword">typedef</span> <span class="keyword">typename</span> GROUP_PRECOMP::Element Element;
<a name="l00618"></a>00618         <span class="keyword">typedef</span> BASE_PRECOMP BasePrecomputation;
<a name="l00619"></a>00619         
<a name="l00620"></a>00620         <span class="keyword">const</span> <a class="code" href="class_d_l___group_precomputation.html">DL_GroupPrecomputation&lt;Element&gt;</a> &amp; GetGroupPrecomputation()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_groupPrecomputation;}
<a name="l00621"></a>00621         <span class="keyword">const</span> <a class="code" href="class_d_l___fixed_base_precomputation.html">DL_FixedBasePrecomputation&lt;Element&gt;</a> &amp; GetBasePrecomputation()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_gpc;}
<a name="l00622"></a>00622         <a class="code" href="class_d_l___fixed_base_precomputation.html">DL_FixedBasePrecomputation&lt;Element&gt;</a> &amp; AccessBasePrecomputation() {<span class="keywordflow">return</span> m_gpc;}
<a name="l00623"></a>00623 
<a name="l00624"></a>00624 <span class="keyword">protected</span>:
<a name="l00625"></a>00625         GROUP_PRECOMP m_groupPrecomputation;
<a name="l00626"></a>00626         BASE_PRECOMP m_gpc;
<a name="l00627"></a>00627 };
<a name="l00628"></a>00628 <span class="comment"></span>
<a name="l00629"></a>00629 <span class="comment">//! _</span>
<a name="l00630"></a>00630 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00631"></a><a class="code" href="class_d_l___key.html">00631</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_d_l___key.html" title="_">DL_Key</a>
<a name="l00632"></a>00632 {
<a name="l00633"></a>00633 <span class="keyword">public</span>:
<a name="l00634"></a>00634         <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;T&gt;</a> &amp; GetAbstractGroupParameters() <span class="keyword">const</span> =0;
<a name="l00635"></a>00635         <span class="keyword">virtual</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;T&gt;</a> &amp; AccessAbstractGroupParameters() =0;
<a name="l00636"></a>00636 };
<a name="l00637"></a>00637 <span class="comment"></span>
<a name="l00638"></a>00638 <span class="comment">//! interface for DL public keys</span>
<a name="l00639"></a>00639 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00640"></a><a class="code" href="class_d_l___public_key.html">00640</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_d_l___public_key.html" title="interface for DL public keys">DL_PublicKey</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___key.html" title="_">DL_Key</a>&lt;T&gt;
<a name="l00641"></a>00641 {
<a name="l00642"></a>00642         <span class="keyword">typedef</span> <a class="code" href="class_d_l___public_key.html" title="interface for DL public keys">DL_PublicKey&lt;T&gt;</a> <a class="code" href="class_d_l___public_key.html" title="interface for DL public keys">ThisClass</a>;
<a name="l00643"></a>00643 
<a name="l00644"></a>00644 <span class="keyword">public</span>:
<a name="l00645"></a>00645         <span class="keyword">typedef</span> T Element;
<a name="l00646"></a>00646 
<a name="l00647"></a>00647         <span class="keywordtype">bool</span> GetVoidValue(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keyword">const</span> std::type_info &amp;valueType, <span class="keywordtype">void</span> *pValue)<span class="keyword"> const</span>
<a name="l00648"></a>00648 <span class="keyword">        </span>{
<a name="l00649"></a>00649                 <span class="keywordflow">return</span> GetValueHelper(<span class="keyword">this</span>, name, valueType, pValue, &amp;this-&gt;GetAbstractGroupParameters())
<a name="l00650"></a>00650                                 CRYPTOPP_GET_FUNCTION_ENTRY(PublicElement);
<a name="l00651"></a>00651         }
<a name="l00652"></a>00652 
<a name="l00653"></a>00653         <span class="keywordtype">void</span> AssignFrom(<span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;source);
<a name="l00654"></a>00654         
<a name="l00655"></a>00655         <span class="comment">// non-inherited</span>
<a name="l00656"></a>00656         <span class="keyword">virtual</span> <span class="keyword">const</span> Element &amp; GetPublicElement()<span class="keyword"> const </span>{<span class="keywordflow">return</span> GetPublicPrecomputation().GetBase(this-&gt;GetAbstractGroupParameters().GetGroupPrecomputation());}
<a name="l00657"></a>00657         <span class="keyword">virtual</span> <span class="keywordtype">void</span> SetPublicElement(<span class="keyword">const</span> Element &amp;y) {AccessPublicPrecomputation().SetBase(this-&gt;GetAbstractGroupParameters().GetGroupPrecomputation(), y);}
<a name="l00658"></a>00658         <span class="keyword">virtual</span> Element ExponentiatePublicElement(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;exponent)<span class="keyword"> const</span>
<a name="l00659"></a>00659 <span class="keyword">        </span>{
<a name="l00660"></a>00660                 <span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;T&gt;</a> &amp;params = this-&gt;GetAbstractGroupParameters();
<a name="l00661"></a>00661                 <span class="keywordflow">return</span> GetPublicPrecomputation().Exponentiate(params.GetGroupPrecomputation(), exponent);
<a name="l00662"></a>00662         }
<a name="l00663"></a>00663         <span class="keyword">virtual</span> Element CascadeExponentiateBaseAndPublicElement(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;baseExp, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;publicExp)<span class="keyword"> const</span>
<a name="l00664"></a>00664 <span class="keyword">        </span>{
<a name="l00665"></a>00665                 <span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;T&gt;</a> &amp;params = this-&gt;GetAbstractGroupParameters();
<a name="l00666"></a>00666                 <span class="keywordflow">return</span> params.GetBasePrecomputation().CascadeExponentiate(params.GetGroupPrecomputation(), baseExp, GetPublicPrecomputation(), publicExp);
<a name="l00667"></a>00667         }
<a name="l00668"></a>00668 
<a name="l00669"></a>00669         <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="class_d_l___fixed_base_precomputation.html">DL_FixedBasePrecomputation&lt;T&gt;</a> &amp; GetPublicPrecomputation() <span class="keyword">const</span> =0;
<a name="l00670"></a>00670         <span class="keyword">virtual</span> <a class="code" href="class_d_l___fixed_base_precomputation.html">DL_FixedBasePrecomputation&lt;T&gt;</a> &amp; AccessPublicPrecomputation() =0;
<a name="l00671"></a>00671 };
<a name="l00672"></a>00672 <span class="comment"></span>
<a name="l00673"></a>00673 <span class="comment">//! interface for DL private keys</span>
<a name="l00674"></a>00674 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00675"></a><a class="code" href="class_d_l___private_key.html">00675</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_d_l___private_key.html" title="interface for DL private keys">DL_PrivateKey</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___key.html" title="_">DL_Key</a>&lt;T&gt;
<a name="l00676"></a>00676 {
<a name="l00677"></a>00677         <span class="keyword">typedef</span> <a class="code" href="class_d_l___private_key.html" title="interface for DL private keys">DL_PrivateKey&lt;T&gt;</a> <a class="code" href="class_d_l___private_key.html" title="interface for DL private keys">ThisClass</a>;
<a name="l00678"></a>00678 
<a name="l00679"></a>00679 <span class="keyword">public</span>:
<a name="l00680"></a>00680         <span class="keyword">typedef</span> T Element;
<a name="l00681"></a>00681 
<a name="l00682"></a>00682         <span class="keywordtype">void</span> MakePublicKey(<a class="code" href="class_d_l___public_key.html" title="interface for DL public keys">DL_PublicKey&lt;T&gt;</a> &amp;pub)<span class="keyword"> const</span>
<a name="l00683"></a>00683 <span class="keyword">        </span>{
<a name="l00684"></a>00684                 pub.AccessAbstractGroupParameters().AssignFrom(this-&gt;GetAbstractGroupParameters());
<a name="l00685"></a>00685                 pub.SetPublicElement(this-&gt;GetAbstractGroupParameters().ExponentiateBase(GetPrivateExponent()));
<a name="l00686"></a>00686         }
<a name="l00687"></a>00687 
<a name="l00688"></a>00688         <span class="keywordtype">bool</span> GetVoidValue(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keyword">const</span> std::type_info &amp;valueType, <span class="keywordtype">void</span> *pValue)<span class="keyword"> const</span>
<a name="l00689"></a>00689 <span class="keyword">        </span>{
<a name="l00690"></a>00690                 <span class="keywordflow">return</span> GetValueHelper(<span class="keyword">this</span>, name, valueType, pValue, &amp;this-&gt;GetAbstractGroupParameters())
<a name="l00691"></a>00691                                 CRYPTOPP_GET_FUNCTION_ENTRY(PrivateExponent);
<a name="l00692"></a>00692         }
<a name="l00693"></a>00693 
<a name="l00694"></a>00694         <span class="keywordtype">void</span> AssignFrom(<span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;source)
<a name="l00695"></a>00695         {
<a name="l00696"></a>00696                 this-&gt;AccessAbstractGroupParameters().AssignFrom(source);
<a name="l00697"></a>00697                 AssignFromHelper(<span class="keyword">this</span>, source)
<a name="l00698"></a>00698                         CRYPTOPP_SET_FUNCTION_ENTRY(PrivateExponent);
<a name="l00699"></a>00699         }
<a name="l00700"></a>00700 
<a name="l00701"></a>00701         <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp; GetPrivateExponent() <span class="keyword">const</span> =0;
<a name="l00702"></a>00702         <span class="keyword">virtual</span> <span class="keywordtype">void</span> SetPrivateExponent(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;x) =0;
<a name="l00703"></a>00703 };
<a name="l00704"></a>00704 
<a name="l00705"></a>00705 <span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00706"></a>00706 <span class="keywordtype">void</span> <a class="code" href="class_d_l___public_key.html" title="interface for DL public keys">DL_PublicKey&lt;T&gt;::AssignFrom</a>(<span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;source)
<a name="l00707"></a>00707 {
<a name="l00708"></a>00708         <a class="code" href="class_d_l___private_key.html" title="interface for DL private keys">DL_PrivateKey&lt;T&gt;</a> *pPrivateKey = NULL;
<a name="l00709"></a>00709         <span class="keywordflow">if</span> (source.<a class="code" href="class_name_value_pairs.html#a01c64a1e0a5f667898b4c1968a853c0f" title="get a pointer to this object, as a pointer to T">GetThisPointer</a>(pPrivateKey))
<a name="l00710"></a>00710                 pPrivateKey-&gt;MakePublicKey(*<span class="keyword">this</span>);
<a name="l00711"></a>00711         <span class="keywordflow">else</span>
<a name="l00712"></a>00712         {
<a name="l00713"></a>00713                 this-&gt;AccessAbstractGroupParameters().AssignFrom(source);
<a name="l00714"></a>00714                 AssignFromHelper(<span class="keyword">this</span>, source)
<a name="l00715"></a>00715                         CRYPTOPP_SET_FUNCTION_ENTRY(PublicElement);
<a name="l00716"></a>00716         }
<a name="l00717"></a>00717 }
<a name="l00718"></a>00718 
<a name="l00719"></a>00719 class <a class="code" href="class_o_i_d.html" title="Object Identifier.">OID</a>;
<a name="l00720"></a>00720 <span class="comment"></span>
<a name="l00721"></a>00721 <span class="comment">//! _</span>
<a name="l00722"></a>00722 <span class="comment"></span>template &lt;class PK, class GP, class O = OID&gt;
<a name="l00723"></a><a class="code" href="class_d_l___key_impl.html">00723</a> class <a class="code" href="class_d_l___key_impl.html" title="_">DL_KeyImpl</a> : public PK
<a name="l00724"></a>00724 {
<a name="l00725"></a>00725 <span class="keyword">public</span>:
<a name="l00726"></a>00726         <span class="keyword">typedef</span> GP GroupParameters;
<a name="l00727"></a>00727 
<a name="l00728"></a>00728         O GetAlgorithmID()<span class="keyword"> const </span>{<span class="keywordflow">return</span> GetGroupParameters().GetAlgorithmID();}
<a name="l00729"></a>00729 <span class="comment">//      void BERDecode(BufferedTransformation &amp;bt)</span>
<a name="l00730"></a>00730 <span class="comment">//              {PK::BERDecode(bt);}</span>
<a name="l00731"></a>00731 <span class="comment">//      void DEREncode(BufferedTransformation &amp;bt) const</span>
<a name="l00732"></a>00732 <span class="comment">//              {PK::DEREncode(bt);}</span>
<a name="l00733"></a>00733         <span class="keywordtype">bool</span> BERDecodeAlgorithmParameters(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;bt)
<a name="l00734"></a>00734                 {AccessGroupParameters().BERDecode(bt); <span class="keywordflow">return</span> <span class="keyword">true</span>;}
<a name="l00735"></a>00735         <span class="keywordtype">bool</span> DEREncodeAlgorithmParameters(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;bt)<span class="keyword"> const</span>
<a name="l00736"></a>00736 <span class="keyword">                </span>{GetGroupParameters().DEREncode(bt); <span class="keywordflow">return</span> <span class="keyword">true</span>;}
<a name="l00737"></a>00737 
<a name="l00738"></a>00738         <span class="keyword">const</span> GP &amp; GetGroupParameters()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_groupParameters;}
<a name="l00739"></a>00739         GP &amp; AccessGroupParameters() {<span class="keywordflow">return</span> m_groupParameters;}
<a name="l00740"></a>00740 
<a name="l00741"></a>00741 <span class="keyword">private</span>:
<a name="l00742"></a>00742         GP m_groupParameters;
<a name="l00743"></a>00743 };
<a name="l00744"></a>00744 
<a name="l00745"></a>00745 <span class="keyword">class </span><a class="code" href="class_x509_public_key.html" title="encodes/decodes subjectPublicKeyInfo">X509PublicKey</a>;
<a name="l00746"></a>00746 <span class="keyword">class </span><a class="code" href="class_p_k_c_s8_private_key.html" title="encodes/decodes privateKeyInfo">PKCS8PrivateKey</a>;
<a name="l00747"></a>00747 <span class="comment"></span>
<a name="l00748"></a>00748 <span class="comment">//! _</span>
<a name="l00749"></a>00749 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> GP&gt;
<a name="l00750"></a><a class="code" href="class_d_l___private_key_impl.html">00750</a> <span class="keyword">class </span><a class="code" href="class_d_l___private_key_impl.html" title="_">DL_PrivateKeyImpl</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___private_key.html" title="interface for DL private keys">DL_PrivateKey</a>&lt;CPP_TYPENAME GP::Element&gt;, <span class="keyword">public</span> <a class="code" href="class_d_l___key_impl.html" title="_">DL_KeyImpl</a>&lt;PKCS8PrivateKey, GP&gt;
<a name="l00751"></a>00751 {
<a name="l00752"></a>00752 <span class="keyword">public</span>:
<a name="l00753"></a>00753         <span class="keyword">typedef</span> <span class="keyword">typename</span> GP::Element Element;
<a name="l00754"></a>00754 
<a name="l00755"></a>00755         <span class="comment">// GeneratableCryptoMaterial</span>
<a name="l00756"></a><a class="code" href="class_d_l___private_key_impl.html#aa4ad7f55ea46d222c5e7e37f67bd20fe">00756</a>         <span class="keywordtype">bool</span> Validate(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> level)<span class="keyword"> const</span>
<a name="l00757"></a>00757 <span class="keyword">        </span>{
<a name="l00758"></a>00758                 <span class="keywordtype">bool</span> pass = GetAbstractGroupParameters().Validate(rng, level);
<a name="l00759"></a>00759 
<a name="l00760"></a>00760                 <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;q = GetAbstractGroupParameters().GetSubgroupOrder();
<a name="l00761"></a>00761                 <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;x = GetPrivateExponent();
<a name="l00762"></a>00762 
<a name="l00763"></a>00763                 pass = pass &amp;&amp; x.IsPositive() &amp;&amp; x &lt; q;
<a name="l00764"></a>00764                 <span class="keywordflow">if</span> (level &gt;= 1)
<a name="l00765"></a>00765                         pass = pass &amp;&amp; <a class="code" href="class_integer.html#a2d4d29937f8ef666717530b30f137c37" title="greatest common divisor">Integer::Gcd</a>(x, q) == <a class="code" href="class_integer.html#a8c070592581bf6c2f928c72bfa1c1638" title="avoid calling constructors for these frequently used integers">Integer::One</a>();
<a name="l00766"></a>00766                 <span class="keywordflow">return</span> pass;
<a name="l00767"></a>00767         }
<a name="l00768"></a>00768 
<a name="l00769"></a>00769         <span class="keywordtype">bool</span> GetVoidValue(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keyword">const</span> std::type_info &amp;valueType, <span class="keywordtype">void</span> *pValue)<span class="keyword"> const</span>
<a name="l00770"></a>00770 <span class="keyword">        </span>{
<a name="l00771"></a>00771                 <span class="keywordflow">return</span> GetValueHelper&lt;DL_PrivateKey&lt;Element&gt; &gt;(<span class="keyword">this</span>, name, valueType, pValue).Assignable();
<a name="l00772"></a>00772         }
<a name="l00773"></a>00773 
<a name="l00774"></a>00774         <span class="keywordtype">void</span> AssignFrom(<span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;source)
<a name="l00775"></a>00775         {
<a name="l00776"></a>00776                 AssignFromHelper&lt;DL_PrivateKey&lt;Element&gt; &gt;(<span class="keyword">this</span>, source);
<a name="l00777"></a>00777         }
<a name="l00778"></a>00778 
<a name="l00779"></a><a class="code" href="class_d_l___private_key_impl.html#ab80a3771a5ef623677775f7c5dddb1e0">00779</a>         <span class="keywordtype">void</span> GenerateRandom(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;params)
<a name="l00780"></a>00780         {
<a name="l00781"></a>00781                 <span class="keywordflow">if</span> (!params.<a class="code" href="class_name_value_pairs.html#ab7afe4b5e1ced5cc8fa6f695bd7bd98c" title="get a copy of this object or a subobject of it">GetThisObject</a>(this-&gt;AccessGroupParameters()))
<a name="l00782"></a>00782                         this-&gt;AccessGroupParameters().GenerateRandom(rng, params);
<a name="l00783"></a>00783 <span class="comment">//              std::pair&lt;const byte *, int&gt; seed;</span>
<a name="l00784"></a>00784                 <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> x(rng, <a class="code" href="class_integer.html#a8c070592581bf6c2f928c72bfa1c1638" title="avoid calling constructors for these frequently used integers">Integer::One</a>(), GetAbstractGroupParameters().GetMaxExponent());
<a name="l00785"></a>00785 <span class="comment">//                      Integer::ANY, Integer::Zero(), Integer::One(),</span>
<a name="l00786"></a>00786 <span class="comment">//                      params.GetValue(&quot;DeterministicKeyGenerationSeed&quot;, seed) ? &amp;seed : NULL);</span>
<a name="l00787"></a>00787                 SetPrivateExponent(x);
<a name="l00788"></a>00788         }
<a name="l00789"></a>00789 
<a name="l00790"></a><a class="code" href="class_d_l___private_key_impl.html#ae8e4b6e0d700c92852a0c3edbb9afaee">00790</a>         <span class="keywordtype">bool</span> <a class="code" href="class_d_l___private_key_impl.html#ae8e4b6e0d700c92852a0c3edbb9afaee">SupportsPrecomputation</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <span class="keyword">true</span>;}
<a name="l00791"></a>00791 
<a name="l00792"></a><a class="code" href="class_d_l___private_key_impl.html#ac1876a3d292e192186070869be896ded">00792</a>         <span class="keywordtype">void</span> Precompute(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> precomputationStorage=16)
<a name="l00793"></a>00793                 {AccessAbstractGroupParameters().Precompute(precomputationStorage);}
<a name="l00794"></a>00794 
<a name="l00795"></a><a class="code" href="class_d_l___private_key_impl.html#ae8acefe0a54ff6153d4ca5231ccac951">00795</a>         <span class="keywordtype">void</span> LoadPrecomputation(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;storedPrecomputation)
<a name="l00796"></a>00796                 {AccessAbstractGroupParameters().LoadPrecomputation(storedPrecomputation);}
<a name="l00797"></a>00797 
<a name="l00798"></a><a class="code" href="class_d_l___private_key_impl.html#ad2599d9c720966f22e0cae5dfdaaed41">00798</a>         <span class="keywordtype">void</span> SavePrecomputation(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;storedPrecomputation)<span class="keyword"> const</span>
<a name="l00799"></a>00799 <span class="keyword">                </span>{GetAbstractGroupParameters().SavePrecomputation(storedPrecomputation);}
<a name="l00800"></a>00800 
<a name="l00801"></a>00801         <span class="comment">// DL_Key</span>
<a name="l00802"></a>00802         <span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;Element&gt;</a> &amp; GetAbstractGroupParameters()<span class="keyword"> const </span>{<span class="keywordflow">return</span> this-&gt;GetGroupParameters();}
<a name="l00803"></a>00803         <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;Element&gt;</a> &amp; AccessAbstractGroupParameters() {<span class="keywordflow">return</span> this-&gt;AccessGroupParameters();}
<a name="l00804"></a>00804 
<a name="l00805"></a>00805         <span class="comment">// DL_PrivateKey</span>
<a name="l00806"></a>00806         <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp; GetPrivateExponent()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_x;}
<a name="l00807"></a>00807         <span class="keywordtype">void</span> SetPrivateExponent(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;x) {m_x = x;}
<a name="l00808"></a>00808 
<a name="l00809"></a>00809         <span class="comment">// PKCS8PrivateKey</span>
<a name="l00810"></a><a class="code" href="class_d_l___private_key_impl.html#a0d0c5c926211c5b35002dd3b8d22664c">00810</a>         <span class="keywordtype">void</span> BERDecodePrivateKey(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;bt, <span class="keywordtype">bool</span>, <span class="keywordtype">size_t</span>)
<a name="l00811"></a>00811                 {m_x.BERDecode(bt);}
<a name="l00812"></a><a class="code" href="class_d_l___private_key_impl.html#aad8607ecf772a7b7faa9960152261009">00812</a>         <span class="keywordtype">void</span> DEREncodePrivateKey(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;bt)<span class="keyword"> const</span>
<a name="l00813"></a>00813 <span class="keyword">                </span>{m_x.DEREncode(bt);}
<a name="l00814"></a>00814 
<a name="l00815"></a>00815 <span class="keyword">private</span>:
<a name="l00816"></a>00816         <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> m_x;
<a name="l00817"></a>00817 };
<a name="l00818"></a>00818 <span class="comment"></span>
<a name="l00819"></a>00819 <span class="comment">//! _</span>
<a name="l00820"></a>00820 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> BASE, <span class="keyword">class</span> SIGNATURE_SCHEME&gt;
<a name="l00821"></a><a class="code" href="class_d_l___private_key___with_signature_pairwise_consistency_test.html">00821</a> <span class="keyword">class </span><a class="code" href="class_d_l___private_key___with_signature_pairwise_consistency_test.html" title="_">DL_PrivateKey_WithSignaturePairwiseConsistencyTest</a> : <span class="keyword">public</span> <a class="code" href="class_b_a_s_e.html">BASE</a>
<a name="l00822"></a>00822 {
<a name="l00823"></a>00823 <span class="keyword">public</span>:
<a name="l00824"></a>00824         <span class="keywordtype">void</span> GenerateRandom(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;params)
<a name="l00825"></a>00825         {
<a name="l00826"></a>00826                 BASE::GenerateRandom(rng, params);
<a name="l00827"></a>00827 
<a name="l00828"></a>00828                 <span class="keywordflow">if</span> (FIPS_140_2_ComplianceEnabled())
<a name="l00829"></a>00829                 {
<a name="l00830"></a>00830                         <span class="keyword">typename</span> SIGNATURE_SCHEME::Signer signer(*<span class="keyword">this</span>);
<a name="l00831"></a>00831                         <span class="keyword">typename</span> SIGNATURE_SCHEME::Verifier verifier(signer);
<a name="l00832"></a>00832                         SignaturePairwiseConsistencyTest_FIPS_140_Only(signer, verifier);
<a name="l00833"></a>00833                 }
<a name="l00834"></a>00834         }
<a name="l00835"></a>00835 };
<a name="l00836"></a>00836 <span class="comment"></span>
<a name="l00837"></a>00837 <span class="comment">//! _</span>
<a name="l00838"></a>00838 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> GP&gt;
<a name="l00839"></a><a class="code" href="class_d_l___public_key_impl.html">00839</a> <span class="keyword">class </span><a class="code" href="class_d_l___public_key_impl.html" title="_">DL_PublicKeyImpl</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___public_key.html" title="interface for DL public keys">DL_PublicKey</a>&lt;typename GP::Element&gt;, <span class="keyword">public</span> <a class="code" href="class_d_l___key_impl.html" title="_">DL_KeyImpl</a>&lt;X509PublicKey, GP&gt;
<a name="l00840"></a>00840 {
<a name="l00841"></a>00841 <span class="keyword">public</span>:
<a name="l00842"></a>00842         <span class="keyword">typedef</span> <span class="keyword">typename</span> GP::Element Element;
<a name="l00843"></a>00843 
<a name="l00844"></a>00844         <span class="comment">// CryptoMaterial</span>
<a name="l00845"></a><a class="code" href="class_d_l___public_key_impl.html#a85fab6591b1420642f414d6d9669b298">00845</a>         <span class="keywordtype">bool</span> Validate(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> level)<span class="keyword"> const</span>
<a name="l00846"></a>00846 <span class="keyword">        </span>{
<a name="l00847"></a>00847                 <span class="keywordtype">bool</span> pass = GetAbstractGroupParameters().Validate(rng, level);
<a name="l00848"></a>00848                 pass = pass &amp;&amp; GetAbstractGroupParameters().ValidateElement(level, this-&gt;GetPublicElement(), &amp;GetPublicPrecomputation());
<a name="l00849"></a>00849                 <span class="keywordflow">return</span> pass;
<a name="l00850"></a>00850         }
<a name="l00851"></a>00851 
<a name="l00852"></a>00852         <span class="keywordtype">bool</span> GetVoidValue(<span class="keyword">const</span> <span class="keywordtype">char</span> *name, <span class="keyword">const</span> std::type_info &amp;valueType, <span class="keywordtype">void</span> *pValue)<span class="keyword"> const</span>
<a name="l00853"></a>00853 <span class="keyword">        </span>{
<a name="l00854"></a>00854                 <span class="keywordflow">return</span> GetValueHelper&lt;DL_PublicKey&lt;Element&gt; &gt;(<span class="keyword">this</span>, name, valueType, pValue).Assignable();
<a name="l00855"></a>00855         }
<a name="l00856"></a>00856 
<a name="l00857"></a>00857         <span class="keywordtype">void</span> AssignFrom(<span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;source)
<a name="l00858"></a>00858         {
<a name="l00859"></a>00859                 AssignFromHelper&lt;DL_PublicKey&lt;Element&gt; &gt;(<span class="keyword">this</span>, source);
<a name="l00860"></a>00860         }
<a name="l00861"></a>00861 
<a name="l00862"></a><a class="code" href="class_d_l___public_key_impl.html#a16711647065fe1c20f118460646ccc38">00862</a>         <span class="keywordtype">bool</span> <a class="code" href="class_d_l___public_key_impl.html#a16711647065fe1c20f118460646ccc38">SupportsPrecomputation</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <span class="keyword">true</span>;}
<a name="l00863"></a>00863 
<a name="l00864"></a><a class="code" href="class_d_l___public_key_impl.html#a95e25f6632ec2621289d10abc557b17b">00864</a>         <span class="keywordtype">void</span> Precompute(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> precomputationStorage=16)
<a name="l00865"></a>00865         {
<a name="l00866"></a>00866                 AccessAbstractGroupParameters().Precompute(precomputationStorage);
<a name="l00867"></a>00867                 AccessPublicPrecomputation().Precompute(GetAbstractGroupParameters().GetGroupPrecomputation(), GetAbstractGroupParameters().GetSubgroupOrder().BitCount(), precomputationStorage);
<a name="l00868"></a>00868         }
<a name="l00869"></a>00869 
<a name="l00870"></a><a class="code" href="class_d_l___public_key_impl.html#a8f1379edc09486d79c3ad6c374d01243">00870</a>         <span class="keywordtype">void</span> LoadPrecomputation(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;storedPrecomputation)
<a name="l00871"></a>00871         {
<a name="l00872"></a>00872                 AccessAbstractGroupParameters().LoadPrecomputation(storedPrecomputation);
<a name="l00873"></a>00873                 AccessPublicPrecomputation().Load(GetAbstractGroupParameters().GetGroupPrecomputation(), storedPrecomputation);
<a name="l00874"></a>00874         }
<a name="l00875"></a>00875 
<a name="l00876"></a><a class="code" href="class_d_l___public_key_impl.html#a61ebc126c2ed4db8e8bb34c0b32bc4d0">00876</a>         <span class="keywordtype">void</span> SavePrecomputation(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;storedPrecomputation)<span class="keyword"> const</span>
<a name="l00877"></a>00877 <span class="keyword">        </span>{
<a name="l00878"></a>00878                 GetAbstractGroupParameters().SavePrecomputation(storedPrecomputation);
<a name="l00879"></a>00879                 GetPublicPrecomputation().Save(GetAbstractGroupParameters().GetGroupPrecomputation(), storedPrecomputation);
<a name="l00880"></a>00880         }
<a name="l00881"></a>00881 
<a name="l00882"></a>00882         <span class="comment">// DL_Key</span>
<a name="l00883"></a>00883         <span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;Element&gt;</a> &amp; GetAbstractGroupParameters()<span class="keyword"> const </span>{<span class="keywordflow">return</span> this-&gt;GetGroupParameters();}
<a name="l00884"></a>00884         <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;Element&gt;</a> &amp; AccessAbstractGroupParameters() {<span class="keywordflow">return</span> this-&gt;AccessGroupParameters();}
<a name="l00885"></a>00885 
<a name="l00886"></a>00886         <span class="comment">// DL_PublicKey</span>
<a name="l00887"></a>00887         <span class="keyword">const</span> <a class="code" href="class_d_l___fixed_base_precomputation.html">DL_FixedBasePrecomputation&lt;Element&gt;</a> &amp; GetPublicPrecomputation()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_ypc;}
<a name="l00888"></a>00888         <a class="code" href="class_d_l___fixed_base_precomputation.html">DL_FixedBasePrecomputation&lt;Element&gt;</a> &amp; AccessPublicPrecomputation() {<span class="keywordflow">return</span> m_ypc;}
<a name="l00889"></a>00889 
<a name="l00890"></a>00890         <span class="comment">// non-inherited</span>
<a name="l00891"></a>00891         <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> <a class="code" href="class_d_l___public_key_impl.html" title="_">DL_PublicKeyImpl&lt;GP&gt;</a> &amp;rhs)<span class="keyword"> const</span>
<a name="l00892"></a>00892 <span class="keyword">                </span>{<span class="keywordflow">return</span> this-&gt;GetGroupParameters() == rhs.GetGroupParameters() &amp;&amp; this-&gt;GetPublicElement() == rhs.GetPublicElement();}
<a name="l00893"></a>00893 
<a name="l00894"></a>00894 <span class="keyword">private</span>:
<a name="l00895"></a>00895         <span class="keyword">typename</span> GP::BasePrecomputation m_ypc;
<a name="l00896"></a>00896 };
<a name="l00897"></a>00897 <span class="comment"></span>
<a name="l00898"></a>00898 <span class="comment">//! interface for Elgamal-like signature algorithms</span>
<a name="l00899"></a>00899 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00900"></a><a class="code" href="class_d_l___elgamal_like_signature_algorithm.html">00900</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_d_l___elgamal_like_signature_algorithm.html" title="interface for Elgamal-like signature algorithms">DL_ElgamalLikeSignatureAlgorithm</a>
<a name="l00901"></a>00901 {
<a name="l00902"></a>00902 <span class="keyword">public</span>:
<a name="l00903"></a>00903         <span class="keyword">virtual</span> <span class="keywordtype">void</span> Sign(<span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;T&gt;</a> &amp;params, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;privateKey, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;k, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;e, <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;r, <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;s) <span class="keyword">const</span> =0;
<a name="l00904"></a>00904         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> Verify(<span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;T&gt;</a> &amp;params, <span class="keyword">const</span> <a class="code" href="class_d_l___public_key.html" title="interface for DL public keys">DL_PublicKey&lt;T&gt;</a> &amp;publicKey, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;e, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;r, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;s) <span class="keyword">const</span> =0;
<a name="l00905"></a>00905         <span class="keyword">virtual</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> RecoverPresignature(<span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;T&gt;</a> &amp;params, <span class="keyword">const</span> <a class="code" href="class_d_l___public_key.html" title="interface for DL public keys">DL_PublicKey&lt;T&gt;</a> &amp;publicKey, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;r, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;s)<span class="keyword"> const</span>
<a name="l00906"></a>00906 <span class="keyword">                </span>{<span class="keywordflow">throw</span> <a class="code" href="class_not_implemented.html" title="exception thrown by a class if a non-implemented method is called">NotImplemented</a>(<span class="stringliteral">&quot;DL_ElgamalLikeSignatureAlgorithm: this signature scheme does not support message recovery&quot;</span>);}
<a name="l00907"></a>00907         <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> RLen(<span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;T&gt;</a> &amp;params)<span class="keyword"> const</span>
<a name="l00908"></a>00908 <span class="keyword">                </span>{<span class="keywordflow">return</span> params.GetSubgroupOrder().<a class="code" href="class_integer.html#aea4f2d31725ab02c67d9ea0288767670" title="number of significant bytes = ceiling(BitCount()/8)">ByteCount</a>();}
<a name="l00909"></a>00909         <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> SLen(<span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;T&gt;</a> &amp;params)<span class="keyword"> const</span>
<a name="l00910"></a>00910 <span class="keyword">                </span>{<span class="keywordflow">return</span> params.GetSubgroupOrder().<a class="code" href="class_integer.html#aea4f2d31725ab02c67d9ea0288767670" title="number of significant bytes = ceiling(BitCount()/8)">ByteCount</a>();}
<a name="l00911"></a>00911 };
<a name="l00912"></a>00912 <span class="comment"></span>
<a name="l00913"></a>00913 <span class="comment">//! interface for DL key agreement algorithms</span>
<a name="l00914"></a>00914 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00915"></a><a class="code" href="class_d_l___key_agreement_algorithm.html">00915</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_d_l___key_agreement_algorithm.html" title="interface for DL key agreement algorithms">DL_KeyAgreementAlgorithm</a>
<a name="l00916"></a>00916 {
<a name="l00917"></a>00917 <span class="keyword">public</span>:
<a name="l00918"></a>00918         <span class="keyword">typedef</span> T Element;
<a name="l00919"></a>00919 
<a name="l00920"></a>00920         <span class="keyword">virtual</span> Element AgreeWithEphemeralPrivateKey(<span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;Element&gt;</a> &amp;params, <span class="keyword">const</span> <a class="code" href="class_d_l___fixed_base_precomputation.html">DL_FixedBasePrecomputation&lt;Element&gt;</a> &amp;publicPrecomputation, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;privateExponent) <span class="keyword">const</span> =0;
<a name="l00921"></a>00921         <span class="keyword">virtual</span> Element AgreeWithStaticPrivateKey(<span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;Element&gt;</a> &amp;params, <span class="keyword">const</span> Element &amp;publicElement, <span class="keywordtype">bool</span> validateOtherPublicKey, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;privateExponent) <span class="keyword">const</span> =0;
<a name="l00922"></a>00922 };
<a name="l00923"></a>00923 <span class="comment"></span>
<a name="l00924"></a>00924 <span class="comment">//! interface for key derivation algorithms used in DL cryptosystems</span>
<a name="l00925"></a>00925 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00926"></a><a class="code" href="class_d_l___key_derivation_algorithm.html">00926</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_d_l___key_derivation_algorithm.html" title="interface for key derivation algorithms used in DL cryptosystems">DL_KeyDerivationAlgorithm</a>
<a name="l00927"></a>00927 {
<a name="l00928"></a>00928 <span class="keyword">public</span>:
<a name="l00929"></a>00929         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> ParameterSupported(<span class="keyword">const</span> <span class="keywordtype">char</span> *name)<span class="keyword"> const </span>{<span class="keywordflow">return</span> <span class="keyword">false</span>;}
<a name="l00930"></a>00930         <span class="keyword">virtual</span> <span class="keywordtype">void</span> Derive(<span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;T&gt;</a> &amp;groupParams, byte *derivedKey, <span class="keywordtype">size_t</span> derivedLength, <span class="keyword">const</span> T &amp;agreedElement, <span class="keyword">const</span> T &amp;ephemeralPublicKey, <span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;derivationParams) <span class="keyword">const</span> =0;
<a name="l00931"></a>00931 };
<a name="l00932"></a>00932 <span class="comment"></span>
<a name="l00933"></a>00933 <span class="comment">//! interface for symmetric encryption algorithms used in DL cryptosystems</span>
<a name="l00934"></a><a class="code" href="class_d_l___symmetric_encryption_algorithm.html">00934</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_d_l___symmetric_encryption_algorithm.html" title="interface for symmetric encryption algorithms used in DL cryptosystems">DL_SymmetricEncryptionAlgorithm</a>
<a name="l00935"></a>00935 {
<a name="l00936"></a>00936 <span class="keyword">public</span>:
<a name="l00937"></a>00937         <span class="keyword">virtual</span> <span class="keywordtype">bool</span> ParameterSupported(<span class="keyword">const</span> <span class="keywordtype">char</span> *name)<span class="keyword"> const </span>{<span class="keywordflow">return</span> <span class="keyword">false</span>;}
<a name="l00938"></a>00938         <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> GetSymmetricKeyLength(<span class="keywordtype">size_t</span> plaintextLength) <span class="keyword">const</span> =0;
<a name="l00939"></a>00939         <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> GetSymmetricCiphertextLength(<span class="keywordtype">size_t</span> plaintextLength) <span class="keyword">const</span> =0;
<a name="l00940"></a>00940         <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> GetMaxSymmetricPlaintextLength(<span class="keywordtype">size_t</span> ciphertextLength) <span class="keyword">const</span> =0;
<a name="l00941"></a>00941         <span class="keyword">virtual</span> <span class="keywordtype">void</span> SymmetricEncrypt(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> byte *key, <span class="keyword">const</span> byte *plaintext, <span class="keywordtype">size_t</span> plaintextLength, byte *ciphertext, <span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;parameters) <span class="keyword">const</span> =0;
<a name="l00942"></a>00942         <span class="keyword">virtual</span> <a class="code" href="struct_decoding_result.html" title="used to return decoding results">DecodingResult</a> SymmetricDecrypt(<span class="keyword">const</span> byte *key, <span class="keyword">const</span> byte *ciphertext, <span class="keywordtype">size_t</span> ciphertextLength, byte *plaintext, <span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;parameters) <span class="keyword">const</span> =0;
<a name="l00943"></a>00943 };
<a name="l00944"></a>00944 <span class="comment"></span>
<a name="l00945"></a>00945 <span class="comment">//! _</span>
<a name="l00946"></a>00946 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> KI&gt;
<a name="l00947"></a><a class="code" href="class_d_l___base.html">00947</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_d_l___base.html" title="_">DL_Base</a>
<a name="l00948"></a>00948 {
<a name="l00949"></a>00949 <span class="keyword">protected</span>:
<a name="l00950"></a>00950         <span class="keyword">typedef</span> KI KeyInterface;
<a name="l00951"></a>00951         <span class="keyword">typedef</span> <span class="keyword">typename</span> KI::Element Element;
<a name="l00952"></a>00952 
<a name="l00953"></a>00953         <span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;Element&gt;</a> &amp; GetAbstractGroupParameters()<span class="keyword"> const </span>{<span class="keywordflow">return</span> GetKeyInterface().GetAbstractGroupParameters();}
<a name="l00954"></a>00954         <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;Element&gt;</a> &amp; AccessAbstractGroupParameters() {<span class="keywordflow">return</span> AccessKeyInterface().AccessAbstractGroupParameters();}
<a name="l00955"></a>00955 
<a name="l00956"></a>00956         <span class="keyword">virtual</span> KeyInterface &amp; AccessKeyInterface() =0;
<a name="l00957"></a>00957         <span class="keyword">virtual</span> <span class="keyword">const</span> KeyInterface &amp; GetKeyInterface() <span class="keyword">const</span> =0;
<a name="l00958"></a>00958 };
<a name="l00959"></a>00959 <span class="comment"></span>
<a name="l00960"></a>00960 <span class="comment">//! _</span>
<a name="l00961"></a>00961 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> INTERFACE, <span class="keyword">class</span> KEY_INTERFACE&gt;
<a name="l00962"></a><a class="code" href="class_d_l___signature_scheme_base.html">00962</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_d_l___signature_scheme_base.html" title="_">DL_SignatureSchemeBase</a> : <span class="keyword">public</span> <a class="code" href="class_i_n_t_e_r_f_a_c_e.html">INTERFACE</a>, <span class="keyword">public</span> <a class="code" href="class_d_l___base.html" title="_">DL_Base</a>&lt;KEY_INTERFACE&gt;
<a name="l00963"></a>00963 {
<a name="l00964"></a>00964 <span class="keyword">public</span>:
<a name="l00965"></a>00965         <span class="keywordtype">size_t</span> SignatureLength()<span class="keyword"> const</span>
<a name="l00966"></a>00966 <span class="keyword">        </span>{
<a name="l00967"></a>00967                 <span class="keywordflow">return</span> GetSignatureAlgorithm().RLen(this-&gt;GetAbstractGroupParameters())
<a name="l00968"></a>00968                         + GetSignatureAlgorithm().SLen(this-&gt;GetAbstractGroupParameters());
<a name="l00969"></a>00969         }
<a name="l00970"></a>00970         <span class="keywordtype">size_t</span> MaxRecoverableLength()<span class="keyword"> const </span>
<a name="l00971"></a>00971 <span class="keyword">                </span>{<span class="keywordflow">return</span> GetMessageEncodingInterface().MaxRecoverableLength(0, GetHashIdentifier().second, GetDigestSize());}
<a name="l00972"></a>00972         <span class="keywordtype">size_t</span> MaxRecoverableLengthFromSignatureLength(<span class="keywordtype">size_t</span> signatureLength)<span class="keyword"> const</span>
<a name="l00973"></a>00973 <span class="keyword">                </span>{assert(<span class="keyword">false</span>); <span class="keywordflow">return</span> 0;}      <span class="comment">// TODO</span>
<a name="l00974"></a>00974 
<a name="l00975"></a>00975         <span class="keywordtype">bool</span> IsProbabilistic()<span class="keyword"> const </span>
<a name="l00976"></a>00976 <span class="keyword">                </span>{<span class="keywordflow">return</span> <span class="keyword">true</span>;}
<a name="l00977"></a>00977         <span class="keywordtype">bool</span> AllowNonrecoverablePart()<span class="keyword"> const </span>
<a name="l00978"></a>00978 <span class="keyword">                </span>{<span class="keywordflow">return</span> GetMessageEncodingInterface().AllowNonrecoverablePart();}
<a name="l00979"></a>00979         <span class="keywordtype">bool</span> RecoverablePartFirst()<span class="keyword"> const </span>
<a name="l00980"></a>00980 <span class="keyword">                </span>{<span class="keywordflow">return</span> GetMessageEncodingInterface().RecoverablePartFirst();}
<a name="l00981"></a>00981 
<a name="l00982"></a>00982 <span class="keyword">protected</span>:
<a name="l00983"></a>00983         <span class="keywordtype">size_t</span> MessageRepresentativeLength()<span class="keyword"> const </span>{<span class="keywordflow">return</span> BitsToBytes(MessageRepresentativeBitLength());}
<a name="l00984"></a>00984         <span class="keywordtype">size_t</span> MessageRepresentativeBitLength()<span class="keyword"> const </span>{<span class="keywordflow">return</span> this-&gt;GetAbstractGroupParameters().GetSubgroupOrder().BitCount();}
<a name="l00985"></a>00985 
<a name="l00986"></a>00986         <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="class_d_l___elgamal_like_signature_algorithm.html" title="interface for Elgamal-like signature algorithms">DL_ElgamalLikeSignatureAlgorithm&lt;CPP_TYPENAME KEY_INTERFACE::Element&gt;</a> &amp; GetSignatureAlgorithm() <span class="keyword">const</span> =0;
<a name="l00987"></a>00987         <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="class_p_k___signature_message_encoding_method.html" title="interface for message encoding method for public key signature schemes">PK_SignatureMessageEncodingMethod</a> &amp; GetMessageEncodingInterface() <span class="keyword">const</span> =0;
<a name="l00988"></a>00988         <span class="keyword">virtual</span> HashIdentifier GetHashIdentifier() <span class="keyword">const</span> =0;
<a name="l00989"></a>00989         <span class="keyword">virtual</span> <span class="keywordtype">size_t</span> GetDigestSize() <span class="keyword">const</span> =0;
<a name="l00990"></a>00990 };
<a name="l00991"></a>00991 <span class="comment"></span>
<a name="l00992"></a>00992 <span class="comment">//! _</span>
<a name="l00993"></a>00993 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l00994"></a><a class="code" href="class_d_l___signer_base.html">00994</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_d_l___signer_base.html" title="_">DL_SignerBase</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___signature_scheme_base.html" title="_">DL_SignatureSchemeBase</a>&lt;PK_Signer, DL_PrivateKey&lt;T&gt; &gt;
<a name="l00995"></a>00995 {
<a name="l00996"></a>00996 <span class="keyword">public</span>:
<a name="l00997"></a>00997         <span class="comment">// for validation testing</span>
<a name="l00998"></a>00998         <span class="keywordtype">void</span> RawSign(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;k, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;e, <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;r, <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;s)<span class="keyword"> const</span>
<a name="l00999"></a>00999 <span class="keyword">        </span>{
<a name="l01000"></a>01000                 <span class="keyword">const</span> <a class="code" href="class_d_l___elgamal_like_signature_algorithm.html" title="interface for Elgamal-like signature algorithms">DL_ElgamalLikeSignatureAlgorithm&lt;T&gt;</a> &amp;alg = this-&gt;GetSignatureAlgorithm();
<a name="l01001"></a>01001                 <span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;T&gt;</a> &amp;params = this-&gt;GetAbstractGroupParameters();
<a name="l01002"></a>01002                 <span class="keyword">const</span> <a class="code" href="class_d_l___private_key.html" title="interface for DL private keys">DL_PrivateKey&lt;T&gt;</a> &amp;key = this-&gt;GetKeyInterface();
<a name="l01003"></a>01003 
<a name="l01004"></a>01004                 r = params.ConvertElementToInteger(params.ExponentiateBase(k));
<a name="l01005"></a>01005                 alg.Sign(params, key.GetPrivateExponent(), k, e, r, s);
<a name="l01006"></a>01006         }
<a name="l01007"></a>01007 
<a name="l01008"></a>01008         <span class="keywordtype">void</span> InputRecoverableMessage(<a class="code" href="class_p_k___message_accumulator.html" title="interface for accumulating messages to be signed or verified">PK_MessageAccumulator</a> &amp;messageAccumulator, <span class="keyword">const</span> byte *recoverableMessage, <span class="keywordtype">size_t</span> recoverableMessageLength)<span class="keyword"> const</span>
<a name="l01009"></a>01009 <span class="keyword">        </span>{
<a name="l01010"></a>01010                 <a class="code" href="class_p_k___message_accumulator_base.html">PK_MessageAccumulatorBase</a> &amp;ma = <span class="keyword">static_cast&lt;</span><a class="code" href="class_p_k___message_accumulator_base.html">PK_MessageAccumulatorBase</a> &amp;<span class="keyword">&gt;</span>(messageAccumulator);
<a name="l01011"></a>01011                 ma.m_recoverableMessage.<a class="code" href="class_sec_block.html#a2cf5dc5e31c63eb927f935af6104f36a" title="set contents and size">Assign</a>(recoverableMessage, recoverableMessageLength);
<a name="l01012"></a>01012                 this-&gt;GetMessageEncodingInterface().ProcessRecoverableMessage(ma.AccessHash(), 
<a name="l01013"></a>01013                         recoverableMessage, recoverableMessageLength, 
<a name="l01014"></a>01014                         ma.m_presignature, ma.m_presignature.size(),
<a name="l01015"></a>01015                         ma.m_semisignature);
<a name="l01016"></a>01016         }
<a name="l01017"></a>01017 
<a name="l01018"></a><a class="code" href="class_d_l___signer_base.html#a1c0d9588fc5a340a14342c474b2a52e2">01018</a>         <span class="keywordtype">size_t</span> SignAndRestart(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <a class="code" href="class_p_k___message_accumulator.html" title="interface for accumulating messages to be signed or verified">PK_MessageAccumulator</a> &amp;messageAccumulator, byte *signature, <span class="keywordtype">bool</span> restart)<span class="keyword"> const</span>
<a name="l01019"></a>01019 <span class="keyword">        </span>{
<a name="l01020"></a>01020                 this-&gt;GetMaterial().DoQuickSanityCheck();
<a name="l01021"></a>01021 
<a name="l01022"></a>01022                 <a class="code" href="class_p_k___message_accumulator_base.html">PK_MessageAccumulatorBase</a> &amp;ma = <span class="keyword">static_cast&lt;</span><a class="code" href="class_p_k___message_accumulator_base.html">PK_MessageAccumulatorBase</a> &amp;<span class="keyword">&gt;</span>(messageAccumulator);
<a name="l01023"></a>01023                 <span class="keyword">const</span> <a class="code" href="class_d_l___elgamal_like_signature_algorithm.html" title="interface for Elgamal-like signature algorithms">DL_ElgamalLikeSignatureAlgorithm&lt;T&gt;</a> &amp;alg = this-&gt;GetSignatureAlgorithm();
<a name="l01024"></a>01024                 <span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;T&gt;</a> &amp;params = this-&gt;GetAbstractGroupParameters();
<a name="l01025"></a>01025                 <span class="keyword">const</span> <a class="code" href="class_d_l___private_key.html" title="interface for DL private keys">DL_PrivateKey&lt;T&gt;</a> &amp;key = this-&gt;GetKeyInterface();
<a name="l01026"></a>01026 
<a name="l01027"></a>01027                 <a class="code" href="class_sec_block.html">SecByteBlock</a> representative(this-&gt;MessageRepresentativeLength());
<a name="l01028"></a>01028                 this-&gt;GetMessageEncodingInterface().ComputeMessageRepresentative(
<a name="l01029"></a>01029                         rng, 
<a name="l01030"></a>01030                         ma.m_recoverableMessage, ma.m_recoverableMessage.size(), 
<a name="l01031"></a>01031                         ma.AccessHash(), this-&gt;GetHashIdentifier(), ma.m_empty, 
<a name="l01032"></a>01032                         representative, this-&gt;MessageRepresentativeBitLength());
<a name="l01033"></a>01033                 ma.m_empty = <span class="keyword">true</span>;
<a name="l01034"></a>01034                 <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> e(representative, representative.size());
<a name="l01035"></a>01035 
<a name="l01036"></a>01036                 <span class="comment">// hash message digest into random number k to prevent reusing the same k on a different messages</span>
<a name="l01037"></a>01037                 <span class="comment">// after virtual machine rollback</span>
<a name="l01038"></a>01038                 <span class="keywordflow">if</span> (rng.<a class="code" href="class_random_number_generator.html#a85b1db1d40b57d18a320dba6cfb2e4b6" title="returns true if IncorporateEntropy is implemented">CanIncorporateEntropy</a>())
<a name="l01039"></a>01039                         rng.<a class="code" href="class_random_number_generator.html#a6feb4f0afedb62a495b7a9ae311fa1cb" title="update RNG state with additional unpredictable values">IncorporateEntropy</a>(representative, representative.size());
<a name="l01040"></a>01040                 <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> k(rng, 1, params.GetSubgroupOrder()-1);
<a name="l01041"></a>01041                 <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> r, s;
<a name="l01042"></a>01042                 r = params.ConvertElementToInteger(params.ExponentiateBase(k));
<a name="l01043"></a>01043                 alg.Sign(params, key.GetPrivateExponent(), k, e, r, s);
<a name="l01044"></a>01044 
<a name="l01045"></a>01045                 <span class="comment">/*</span>
<a name="l01046"></a>01046 <span class="comment">                Integer r, s;</span>
<a name="l01047"></a>01047 <span class="comment">                if (this-&gt;MaxRecoverableLength() &gt; 0)</span>
<a name="l01048"></a>01048 <span class="comment">                        r.Decode(ma.m_semisignature, ma.m_semisignature.size());</span>
<a name="l01049"></a>01049 <span class="comment">                else</span>
<a name="l01050"></a>01050 <span class="comment">                        r.Decode(ma.m_presignature, ma.m_presignature.size());</span>
<a name="l01051"></a>01051 <span class="comment">                alg.Sign(params, key.GetPrivateExponent(), ma.m_k, e, r, s);</span>
<a name="l01052"></a>01052 <span class="comment">                */</span>
<a name="l01053"></a>01053 
<a name="l01054"></a>01054                 <span class="keywordtype">size_t</span> rLen = alg.RLen(params);
<a name="l01055"></a>01055                 r.Encode(signature, rLen);
<a name="l01056"></a>01056                 s.Encode(signature+rLen, alg.SLen(params));
<a name="l01057"></a>01057 
<a name="l01058"></a>01058                 <span class="keywordflow">if</span> (restart)
<a name="l01059"></a>01059                         RestartMessageAccumulator(rng, ma);
<a name="l01060"></a>01060 
<a name="l01061"></a>01061                 <span class="keywordflow">return</span> this-&gt;SignatureLength();
<a name="l01062"></a>01062         }
<a name="l01063"></a>01063 
<a name="l01064"></a>01064 <span class="keyword">protected</span>:
<a name="l01065"></a>01065         <span class="keywordtype">void</span> RestartMessageAccumulator(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <a class="code" href="class_p_k___message_accumulator_base.html">PK_MessageAccumulatorBase</a> &amp;ma)<span class="keyword"> const</span>
<a name="l01066"></a>01066 <span class="keyword">        </span>{
<a name="l01067"></a>01067                 <span class="comment">// k needs to be generated before hashing for signature schemes with recovery</span>
<a name="l01068"></a>01068                 <span class="comment">// but to defend against VM rollbacks we need to generate k after hashing.</span>
<a name="l01069"></a>01069                 <span class="comment">// so this code is commented out, since no DL-based signature scheme with recovery</span>
<a name="l01070"></a>01070                 <span class="comment">// has been implemented in Crypto++ anyway</span>
<a name="l01071"></a>01071                 <span class="comment">/*</span>
<a name="l01072"></a>01072 <span class="comment">                const DL_ElgamalLikeSignatureAlgorithm&lt;T&gt; &amp;alg = this-&gt;GetSignatureAlgorithm();</span>
<a name="l01073"></a>01073 <span class="comment">                const DL_GroupParameters&lt;T&gt; &amp;params = this-&gt;GetAbstractGroupParameters();</span>
<a name="l01074"></a>01074 <span class="comment">                ma.m_k.Randomize(rng, 1, params.GetSubgroupOrder()-1);</span>
<a name="l01075"></a>01075 <span class="comment">                ma.m_presignature.New(params.GetEncodedElementSize(false));</span>
<a name="l01076"></a>01076 <span class="comment">                params.ConvertElementToInteger(params.ExponentiateBase(ma.m_k)).Encode(ma.m_presignature, ma.m_presignature.size());</span>
<a name="l01077"></a>01077 <span class="comment">                */</span>
<a name="l01078"></a>01078         }
<a name="l01079"></a>01079 };
<a name="l01080"></a>01080 <span class="comment"></span>
<a name="l01081"></a>01081 <span class="comment">//! _</span>
<a name="l01082"></a>01082 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l01083"></a><a class="code" href="class_d_l___verifier_base.html">01083</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_d_l___verifier_base.html" title="_">DL_VerifierBase</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___signature_scheme_base.html" title="_">DL_SignatureSchemeBase</a>&lt;PK_Verifier, DL_PublicKey&lt;T&gt; &gt;
<a name="l01084"></a>01084 {
<a name="l01085"></a>01085 <span class="keyword">public</span>:
<a name="l01086"></a><a class="code" href="class_d_l___verifier_base.html#a488eb7c192589ca5407e5099bda82166">01086</a>         <span class="keywordtype">void</span> InputSignature(<a class="code" href="class_p_k___message_accumulator.html" title="interface for accumulating messages to be signed or verified">PK_MessageAccumulator</a> &amp;messageAccumulator, <span class="keyword">const</span> byte *signature, <span class="keywordtype">size_t</span> signatureLength)<span class="keyword"> const</span>
<a name="l01087"></a>01087 <span class="keyword">        </span>{
<a name="l01088"></a>01088                 <a class="code" href="class_p_k___message_accumulator_base.html">PK_MessageAccumulatorBase</a> &amp;ma = <span class="keyword">static_cast&lt;</span><a class="code" href="class_p_k___message_accumulator_base.html">PK_MessageAccumulatorBase</a> &amp;<span class="keyword">&gt;</span>(messageAccumulator);
<a name="l01089"></a>01089                 <span class="keyword">const</span> <a class="code" href="class_d_l___elgamal_like_signature_algorithm.html" title="interface for Elgamal-like signature algorithms">DL_ElgamalLikeSignatureAlgorithm&lt;T&gt;</a> &amp;alg = this-&gt;GetSignatureAlgorithm();
<a name="l01090"></a>01090                 <span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;T&gt;</a> &amp;params = this-&gt;GetAbstractGroupParameters();
<a name="l01091"></a>01091 
<a name="l01092"></a>01092                 <span class="keywordtype">size_t</span> rLen = alg.RLen(params);
<a name="l01093"></a>01093                 ma.m_semisignature.<a class="code" href="class_sec_block.html#a2cf5dc5e31c63eb927f935af6104f36a" title="set contents and size">Assign</a>(signature, rLen);
<a name="l01094"></a>01094                 ma.m_s.Decode(signature+rLen, alg.SLen(params));
<a name="l01095"></a>01095 
<a name="l01096"></a>01096                 this-&gt;GetMessageEncodingInterface().ProcessSemisignature(ma.AccessHash(), ma.m_semisignature, ma.m_semisignature.size());
<a name="l01097"></a>01097         }
<a name="l01098"></a>01098         
<a name="l01099"></a><a class="code" href="class_d_l___verifier_base.html#ad0b34892f6f185987d6662a3b842df97">01099</a>         <span class="keywordtype">bool</span> VerifyAndRestart(<a class="code" href="class_p_k___message_accumulator.html" title="interface for accumulating messages to be signed or verified">PK_MessageAccumulator</a> &amp;messageAccumulator)<span class="keyword"> const</span>
<a name="l01100"></a>01100 <span class="keyword">        </span>{
<a name="l01101"></a>01101                 this-&gt;GetMaterial().DoQuickSanityCheck();
<a name="l01102"></a>01102 
<a name="l01103"></a>01103                 <a class="code" href="class_p_k___message_accumulator_base.html">PK_MessageAccumulatorBase</a> &amp;ma = <span class="keyword">static_cast&lt;</span><a class="code" href="class_p_k___message_accumulator_base.html">PK_MessageAccumulatorBase</a> &amp;<span class="keyword">&gt;</span>(messageAccumulator);
<a name="l01104"></a>01104                 <span class="keyword">const</span> <a class="code" href="class_d_l___elgamal_like_signature_algorithm.html" title="interface for Elgamal-like signature algorithms">DL_ElgamalLikeSignatureAlgorithm&lt;T&gt;</a> &amp;alg = this-&gt;GetSignatureAlgorithm();
<a name="l01105"></a>01105                 <span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;T&gt;</a> &amp;params = this-&gt;GetAbstractGroupParameters();
<a name="l01106"></a>01106                 <span class="keyword">const</span> <a class="code" href="class_d_l___public_key.html" title="interface for DL public keys">DL_PublicKey&lt;T&gt;</a> &amp;key = this-&gt;GetKeyInterface();
<a name="l01107"></a>01107 
<a name="l01108"></a>01108                 <a class="code" href="class_sec_block.html">SecByteBlock</a> representative(this-&gt;MessageRepresentativeLength());
<a name="l01109"></a>01109                 this-&gt;GetMessageEncodingInterface().ComputeMessageRepresentative(NullRNG(), ma.m_recoverableMessage, ma.m_recoverableMessage.size(), 
<a name="l01110"></a>01110                         ma.AccessHash(), this-&gt;GetHashIdentifier(), ma.m_empty,
<a name="l01111"></a>01111                         representative, this-&gt;MessageRepresentativeBitLength());
<a name="l01112"></a>01112                 ma.m_empty = <span class="keyword">true</span>;
<a name="l01113"></a>01113                 <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> e(representative, representative.size());
<a name="l01114"></a>01114 
<a name="l01115"></a>01115                 <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> r(ma.m_semisignature, ma.m_semisignature.size());
<a name="l01116"></a>01116                 <span class="keywordflow">return</span> alg.Verify(params, key, e, r, ma.m_s);
<a name="l01117"></a>01117         }
<a name="l01118"></a>01118 
<a name="l01119"></a><a class="code" href="class_d_l___verifier_base.html#ab37d4d41fcc169d71b5b3a9d1e508270">01119</a>         <a class="code" href="struct_decoding_result.html" title="used to return decoding results">DecodingResult</a> RecoverAndRestart(byte *recoveredMessage, <a class="code" href="class_p_k___message_accumulator.html" title="interface for accumulating messages to be signed or verified">PK_MessageAccumulator</a> &amp;messageAccumulator)<span class="keyword"> const</span>
<a name="l01120"></a>01120 <span class="keyword">        </span>{
<a name="l01121"></a>01121                 this-&gt;GetMaterial().DoQuickSanityCheck();
<a name="l01122"></a>01122 
<a name="l01123"></a>01123                 <a class="code" href="class_p_k___message_accumulator_base.html">PK_MessageAccumulatorBase</a> &amp;ma = <span class="keyword">static_cast&lt;</span><a class="code" href="class_p_k___message_accumulator_base.html">PK_MessageAccumulatorBase</a> &amp;<span class="keyword">&gt;</span>(messageAccumulator);
<a name="l01124"></a>01124                 <span class="keyword">const</span> <a class="code" href="class_d_l___elgamal_like_signature_algorithm.html" title="interface for Elgamal-like signature algorithms">DL_ElgamalLikeSignatureAlgorithm&lt;T&gt;</a> &amp;alg = this-&gt;GetSignatureAlgorithm();
<a name="l01125"></a>01125                 <span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;T&gt;</a> &amp;params = this-&gt;GetAbstractGroupParameters();
<a name="l01126"></a>01126                 <span class="keyword">const</span> <a class="code" href="class_d_l___public_key.html" title="interface for DL public keys">DL_PublicKey&lt;T&gt;</a> &amp;key = this-&gt;GetKeyInterface();
<a name="l01127"></a>01127 
<a name="l01128"></a>01128                 <a class="code" href="class_sec_block.html">SecByteBlock</a> representative(this-&gt;MessageRepresentativeLength());
<a name="l01129"></a>01129                 this-&gt;GetMessageEncodingInterface().ComputeMessageRepresentative(
<a name="l01130"></a>01130                         NullRNG(), 
<a name="l01131"></a>01131                         ma.m_recoverableMessage, ma.m_recoverableMessage.size(), 
<a name="l01132"></a>01132                         ma.AccessHash(), this-&gt;GetHashIdentifier(), ma.m_empty,
<a name="l01133"></a>01133                         representative, this-&gt;MessageRepresentativeBitLength());
<a name="l01134"></a>01134                 ma.m_empty = <span class="keyword">true</span>;
<a name="l01135"></a>01135                 <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> e(representative, representative.size());
<a name="l01136"></a>01136 
<a name="l01137"></a>01137                 ma.m_presignature.<a class="code" href="class_sec_block.html#a90d46e577c951d81a2d25a4742a3e979" title="change size, without preserving contents">New</a>(params.GetEncodedElementSize(<span class="keyword">false</span>));
<a name="l01138"></a>01138                 <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> r(ma.m_semisignature, ma.m_semisignature.size());
<a name="l01139"></a>01139                 alg.RecoverPresignature(params, key, r, ma.m_s).<a class="code" href="class_integer.html#ac12ea467de9a609b86ec03d8cb8837e4" title="encode in big-endian format">Encode</a>(ma.m_presignature, ma.m_presignature.size());
<a name="l01140"></a>01140 
<a name="l01141"></a>01141                 <span class="keywordflow">return</span> this-&gt;GetMessageEncodingInterface().RecoverMessageFromSemisignature(
<a name="l01142"></a>01142                         ma.AccessHash(), this-&gt;GetHashIdentifier(),
<a name="l01143"></a>01143                         ma.m_presignature, ma.m_presignature.size(),
<a name="l01144"></a>01144                         ma.m_semisignature, ma.m_semisignature.size(),
<a name="l01145"></a>01145                         recoveredMessage);
<a name="l01146"></a>01146         }
<a name="l01147"></a>01147 };
<a name="l01148"></a>01148 <span class="comment"></span>
<a name="l01149"></a>01149 <span class="comment">//! _</span>
<a name="l01150"></a>01150 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> PK, <span class="keyword">class</span> KI&gt;
<a name="l01151"></a><a class="code" href="class_d_l___crypto_system_base.html">01151</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_d_l___crypto_system_base.html" title="_">DL_CryptoSystemBase</a> : <span class="keyword">public</span> PK, <span class="keyword">public</span> <a class="code" href="class_d_l___base.html" title="_">DL_Base</a>&lt;KI&gt;
<a name="l01152"></a>01152 {
<a name="l01153"></a>01153 <span class="keyword">public</span>:
<a name="l01154"></a>01154         <span class="keyword">typedef</span> <span class="keyword">typename</span> <a class="code" href="class_d_l___base.html" title="_">DL_Base&lt;KI&gt;::Element</a> Element;
<a name="l01155"></a>01155 
<a name="l01156"></a>01156         <span class="keywordtype">size_t</span> MaxPlaintextLength(<span class="keywordtype">size_t</span> ciphertextLength)<span class="keyword"> const</span>
<a name="l01157"></a>01157 <span class="keyword">        </span>{
<a name="l01158"></a>01158                 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> minLen = this-&gt;GetAbstractGroupParameters().GetEncodedElementSize(<span class="keyword">true</span>);
<a name="l01159"></a>01159                 <span class="keywordflow">return</span> ciphertextLength &lt; minLen ? 0 : GetSymmetricEncryptionAlgorithm().GetMaxSymmetricPlaintextLength(ciphertextLength - minLen);
<a name="l01160"></a>01160         }
<a name="l01161"></a>01161 
<a name="l01162"></a>01162         <span class="keywordtype">size_t</span> CiphertextLength(<span class="keywordtype">size_t</span> plaintextLength)<span class="keyword"> const</span>
<a name="l01163"></a>01163 <span class="keyword">        </span>{
<a name="l01164"></a>01164                 <span class="keywordtype">size_t</span> len = GetSymmetricEncryptionAlgorithm().GetSymmetricCiphertextLength(plaintextLength);
<a name="l01165"></a>01165                 <span class="keywordflow">return</span> len == 0 ? 0 : this-&gt;GetAbstractGroupParameters().GetEncodedElementSize(<span class="keyword">true</span>) + len;
<a name="l01166"></a>01166         }
<a name="l01167"></a>01167 
<a name="l01168"></a>01168         <span class="keywordtype">bool</span> ParameterSupported(<span class="keyword">const</span> <span class="keywordtype">char</span> *name)<span class="keyword"> const</span>
<a name="l01169"></a>01169 <span class="keyword">                </span>{<span class="keywordflow">return</span> GetKeyDerivationAlgorithm().ParameterSupported(name) || GetSymmetricEncryptionAlgorithm().ParameterSupported(name);}
<a name="l01170"></a>01170 
<a name="l01171"></a>01171 <span class="keyword">protected</span>:
<a name="l01172"></a>01172         <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="class_d_l___key_agreement_algorithm.html" title="interface for DL key agreement algorithms">DL_KeyAgreementAlgorithm&lt;Element&gt;</a> &amp; GetKeyAgreementAlgorithm() <span class="keyword">const</span> =0;
<a name="l01173"></a>01173         <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="class_d_l___key_derivation_algorithm.html" title="interface for key derivation algorithms used in DL cryptosystems">DL_KeyDerivationAlgorithm&lt;Element&gt;</a> &amp; GetKeyDerivationAlgorithm() <span class="keyword">const</span> =0;
<a name="l01174"></a>01174         <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="class_d_l___symmetric_encryption_algorithm.html" title="interface for symmetric encryption algorithms used in DL cryptosystems">DL_SymmetricEncryptionAlgorithm</a> &amp; GetSymmetricEncryptionAlgorithm() <span class="keyword">const</span> =0;
<a name="l01175"></a>01175 };
<a name="l01176"></a>01176 <span class="comment"></span>
<a name="l01177"></a>01177 <span class="comment">//! _</span>
<a name="l01178"></a>01178 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l01179"></a><a class="code" href="class_d_l___decryptor_base.html">01179</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_d_l___decryptor_base.html" title="_">DL_DecryptorBase</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___crypto_system_base.html" title="_">DL_CryptoSystemBase</a>&lt;PK_Decryptor, DL_PrivateKey&lt;T&gt; &gt;
<a name="l01180"></a>01180 {
<a name="l01181"></a>01181 <span class="keyword">public</span>:
<a name="l01182"></a>01182         <span class="keyword">typedef</span> T Element;
<a name="l01183"></a>01183 
<a name="l01184"></a><a class="code" href="class_d_l___decryptor_base.html#a5a23bde8893b76023182413d24f75b74">01184</a>         <a class="code" href="struct_decoding_result.html" title="used to return decoding results">DecodingResult</a> Decrypt(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> byte *ciphertext, <span class="keywordtype">size_t</span> ciphertextLength, byte *plaintext, <span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;parameters = g_nullNameValuePairs)<span class="keyword"> const</span>
<a name="l01185"></a>01185 <span class="keyword">        </span>{
<a name="l01186"></a>01186                 <span class="keywordflow">try</span>
<a name="l01187"></a>01187                 {
<a name="l01188"></a>01188                         <span class="keyword">const</span> <a class="code" href="class_d_l___key_agreement_algorithm.html" title="interface for DL key agreement algorithms">DL_KeyAgreementAlgorithm&lt;T&gt;</a> &amp;agreeAlg = this-&gt;GetKeyAgreementAlgorithm();
<a name="l01189"></a>01189                         <span class="keyword">const</span> <a class="code" href="class_d_l___key_derivation_algorithm.html" title="interface for key derivation algorithms used in DL cryptosystems">DL_KeyDerivationAlgorithm&lt;T&gt;</a> &amp;derivAlg = this-&gt;GetKeyDerivationAlgorithm();
<a name="l01190"></a>01190                         <span class="keyword">const</span> <a class="code" href="class_d_l___symmetric_encryption_algorithm.html" title="interface for symmetric encryption algorithms used in DL cryptosystems">DL_SymmetricEncryptionAlgorithm</a> &amp;encAlg = this-&gt;GetSymmetricEncryptionAlgorithm();
<a name="l01191"></a>01191                         <span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;T&gt;</a> &amp;params = this-&gt;GetAbstractGroupParameters();
<a name="l01192"></a>01192                         <span class="keyword">const</span> <a class="code" href="class_d_l___private_key.html" title="interface for DL private keys">DL_PrivateKey&lt;T&gt;</a> &amp;key = this-&gt;GetKeyInterface();
<a name="l01193"></a>01193 
<a name="l01194"></a>01194                         Element q = params.DecodeElement(ciphertext, <span class="keyword">true</span>);
<a name="l01195"></a>01195                         <span class="keywordtype">size_t</span> elementSize = params.GetEncodedElementSize(<span class="keyword">true</span>);
<a name="l01196"></a>01196                         ciphertext += elementSize;
<a name="l01197"></a>01197                         ciphertextLength -= elementSize;
<a name="l01198"></a>01198 
<a name="l01199"></a>01199                         Element z = agreeAlg.AgreeWithStaticPrivateKey(params, q, <span class="keyword">true</span>, key.GetPrivateExponent());
<a name="l01200"></a>01200 
<a name="l01201"></a>01201                         <a class="code" href="class_sec_block.html">SecByteBlock</a> derivedKey(encAlg.GetSymmetricKeyLength(encAlg.GetMaxSymmetricPlaintextLength(ciphertextLength)));
<a name="l01202"></a>01202                         derivAlg.Derive(params, derivedKey, derivedKey.size(), z, q, parameters);
<a name="l01203"></a>01203 
<a name="l01204"></a>01204                         <span class="keywordflow">return</span> encAlg.SymmetricDecrypt(derivedKey, ciphertext, ciphertextLength, plaintext, parameters);
<a name="l01205"></a>01205                 }
<a name="l01206"></a>01206                 <span class="keywordflow">catch</span> (<a class="code" href="class_d_l___bad_element.html" title="to be thrown by DecodeElement and AgreeWithStaticPrivateKey">DL_BadElement</a> &amp;)
<a name="l01207"></a>01207                 {
<a name="l01208"></a>01208                         <span class="keywordflow">return</span> <a class="code" href="struct_decoding_result.html" title="used to return decoding results">DecodingResult</a>();
<a name="l01209"></a>01209                 }
<a name="l01210"></a>01210         }
<a name="l01211"></a>01211 };
<a name="l01212"></a>01212 <span class="comment"></span>
<a name="l01213"></a>01213 <span class="comment">//! _</span>
<a name="l01214"></a>01214 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l01215"></a><a class="code" href="class_d_l___encryptor_base.html">01215</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_d_l___encryptor_base.html" title="_">DL_EncryptorBase</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___crypto_system_base.html" title="_">DL_CryptoSystemBase</a>&lt;PK_Encryptor, DL_PublicKey&lt;T&gt; &gt;
<a name="l01216"></a>01216 {
<a name="l01217"></a>01217 <span class="keyword">public</span>:
<a name="l01218"></a>01218         <span class="keyword">typedef</span> T Element;
<a name="l01219"></a>01219 
<a name="l01220"></a><a class="code" href="class_d_l___encryptor_base.html#ac902fd1973e468608758a99b3dc07e6a">01220</a>         <span class="keywordtype">void</span> Encrypt(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> byte *plaintext, <span class="keywordtype">size_t</span> plaintextLength, byte *ciphertext, <span class="keyword">const</span> <a class="code" href="class_name_value_pairs.html" title="interface for retrieving values given their names">NameValuePairs</a> &amp;parameters = g_nullNameValuePairs)<span class="keyword"> const</span>
<a name="l01221"></a>01221 <span class="keyword">        </span>{
<a name="l01222"></a>01222                 <span class="keyword">const</span> <a class="code" href="class_d_l___key_agreement_algorithm.html" title="interface for DL key agreement algorithms">DL_KeyAgreementAlgorithm&lt;T&gt;</a> &amp;agreeAlg = this-&gt;GetKeyAgreementAlgorithm();
<a name="l01223"></a>01223                 <span class="keyword">const</span> <a class="code" href="class_d_l___key_derivation_algorithm.html" title="interface for key derivation algorithms used in DL cryptosystems">DL_KeyDerivationAlgorithm&lt;T&gt;</a> &amp;derivAlg = this-&gt;GetKeyDerivationAlgorithm();
<a name="l01224"></a>01224                 <span class="keyword">const</span> <a class="code" href="class_d_l___symmetric_encryption_algorithm.html" title="interface for symmetric encryption algorithms used in DL cryptosystems">DL_SymmetricEncryptionAlgorithm</a> &amp;encAlg = this-&gt;GetSymmetricEncryptionAlgorithm();
<a name="l01225"></a>01225                 <span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;T&gt;</a> &amp;params = this-&gt;GetAbstractGroupParameters();
<a name="l01226"></a>01226                 <span class="keyword">const</span> <a class="code" href="class_d_l___public_key.html" title="interface for DL public keys">DL_PublicKey&lt;T&gt;</a> &amp;key = this-&gt;GetKeyInterface();
<a name="l01227"></a>01227 
<a name="l01228"></a>01228                 <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> x(rng, <a class="code" href="class_integer.html#a8c070592581bf6c2f928c72bfa1c1638" title="avoid calling constructors for these frequently used integers">Integer::One</a>(), params.GetMaxExponent());
<a name="l01229"></a>01229                 Element q = params.ExponentiateBase(x);
<a name="l01230"></a>01230                 params.EncodeElement(<span class="keyword">true</span>, q, ciphertext);
<a name="l01231"></a>01231                 <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> elementSize = params.GetEncodedElementSize(<span class="keyword">true</span>);
<a name="l01232"></a>01232                 ciphertext += elementSize;
<a name="l01233"></a>01233 
<a name="l01234"></a>01234                 Element z = agreeAlg.AgreeWithEphemeralPrivateKey(params, key.GetPublicPrecomputation(), x);
<a name="l01235"></a>01235 
<a name="l01236"></a>01236                 <a class="code" href="class_sec_block.html">SecByteBlock</a> derivedKey(encAlg.GetSymmetricKeyLength(plaintextLength));
<a name="l01237"></a>01237                 derivAlg.Derive(params, derivedKey, derivedKey.size(), z, q, parameters);
<a name="l01238"></a>01238 
<a name="l01239"></a>01239                 encAlg.SymmetricEncrypt(rng, derivedKey, plaintext, plaintextLength, ciphertext, parameters);
<a name="l01240"></a>01240         }
<a name="l01241"></a>01241 };
<a name="l01242"></a>01242 <span class="comment"></span>
<a name="l01243"></a>01243 <span class="comment">//! _</span>
<a name="l01244"></a>01244 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2&gt;
<a name="l01245"></a><a class="code" href="struct_d_l___scheme_options_base.html">01245</a> <span class="keyword">struct </span><a class="code" href="struct_d_l___scheme_options_base.html" title="_">DL_SchemeOptionsBase</a>
<a name="l01246"></a>01246 {
<a name="l01247"></a>01247         <span class="keyword">typedef</span> T1 AlgorithmInfo;
<a name="l01248"></a>01248         <span class="keyword">typedef</span> T2 GroupParameters;
<a name="l01249"></a>01249         <span class="keyword">typedef</span> <span class="keyword">typename</span> GroupParameters::Element Element;
<a name="l01250"></a>01250 };
<a name="l01251"></a>01251 <span class="comment"></span>
<a name="l01252"></a>01252 <span class="comment">//! _</span>
<a name="l01253"></a>01253 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2&gt;
<a name="l01254"></a><a class="code" href="struct_d_l___keyed_scheme_options.html">01254</a> <span class="keyword">struct </span><a class="code" href="struct_d_l___keyed_scheme_options.html" title="_">DL_KeyedSchemeOptions</a> : <span class="keyword">public</span> <a class="code" href="struct_d_l___scheme_options_base.html" title="_">DL_SchemeOptionsBase</a>&lt;T1, typename T2::PublicKey::GroupParameters&gt;
<a name="l01255"></a>01255 {
<a name="l01256"></a>01256         <span class="keyword">typedef</span> T2 Keys;
<a name="l01257"></a>01257         <span class="keyword">typedef</span> <span class="keyword">typename</span> Keys::PrivateKey <a class="code" href="class_private_key.html" title="interface for private keys">PrivateKey</a>;
<a name="l01258"></a>01258         <span class="keyword">typedef</span> <span class="keyword">typename</span> Keys::PublicKey <a class="code" href="class_public_key.html" title="interface for public keys">PublicKey</a>;
<a name="l01259"></a>01259 };
<a name="l01260"></a>01260 <span class="comment"></span>
<a name="l01261"></a>01261 <span class="comment">//! _</span>
<a name="l01262"></a>01262 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3, <span class="keyword">class</span> T4, <span class="keyword">class</span> T5&gt;
<a name="l01263"></a><a class="code" href="struct_d_l___signature_scheme_options.html">01263</a> <span class="keyword">struct </span><a class="code" href="struct_d_l___signature_scheme_options.html" title="_">DL_SignatureSchemeOptions</a> : <span class="keyword">public</span> <a class="code" href="struct_d_l___keyed_scheme_options.html" title="_">DL_KeyedSchemeOptions</a>&lt;T1, T2&gt;
<a name="l01264"></a>01264 {
<a name="l01265"></a>01265         <span class="keyword">typedef</span> T3 SignatureAlgorithm;
<a name="l01266"></a>01266         <span class="keyword">typedef</span> T4 MessageEncodingMethod;
<a name="l01267"></a>01267         <span class="keyword">typedef</span> T5 <a class="code" href="class_hash_transformation.html" title="interface for hash functions and data processing part of MACs">HashFunction</a>;
<a name="l01268"></a>01268 };
<a name="l01269"></a>01269 <span class="comment"></span>
<a name="l01270"></a>01270 <span class="comment">//! _</span>
<a name="l01271"></a>01271 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3, <span class="keyword">class</span> T4, <span class="keyword">class</span> T5&gt;
<a name="l01272"></a><a class="code" href="struct_d_l___crypto_scheme_options.html">01272</a> <span class="keyword">struct </span><a class="code" href="struct_d_l___crypto_scheme_options.html" title="_">DL_CryptoSchemeOptions</a> : <span class="keyword">public</span> <a class="code" href="struct_d_l___keyed_scheme_options.html" title="_">DL_KeyedSchemeOptions</a>&lt;T1, T2&gt;
<a name="l01273"></a>01273 {
<a name="l01274"></a>01274         <span class="keyword">typedef</span> T3 <a class="code" href="class_key_agreement_algorithm.html" title="interface for key agreement algorithms">KeyAgreementAlgorithm</a>;
<a name="l01275"></a>01275         <span class="keyword">typedef</span> T4 KeyDerivationAlgorithm;
<a name="l01276"></a>01276         <span class="keyword">typedef</span> T5 SymmetricEncryptionAlgorithm;
<a name="l01277"></a>01277 };
<a name="l01278"></a>01278 <span class="comment"></span>
<a name="l01279"></a>01279 <span class="comment">//! _</span>
<a name="l01280"></a>01280 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> BASE, <span class="keyword">class</span> SCHEME_OPTIONS, <span class="keyword">class</span> KEY&gt;
<a name="l01281"></a><a class="code" href="class_d_l___object_impl_base.html">01281</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_d_l___object_impl_base.html" title="_">DL_ObjectImplBase</a> : <span class="keyword">public</span> <a class="code" href="class_algorithm_impl.html" title="_">AlgorithmImpl</a>&lt;BASE, typename SCHEME_OPTIONS::AlgorithmInfo&gt;
<a name="l01282"></a>01282 {
<a name="l01283"></a>01283 <span class="keyword">public</span>:
<a name="l01284"></a>01284         <span class="keyword">typedef</span> SCHEME_OPTIONS SchemeOptions;
<a name="l01285"></a>01285         <span class="keyword">typedef</span> <span class="keyword">typename</span> KEY::Element Element;
<a name="l01286"></a>01286 
<a name="l01287"></a>01287         <a class="code" href="class_private_key.html" title="interface for private keys">PrivateKey</a> &amp; AccessPrivateKey() {<span class="keywordflow">return</span> m_key;}
<a name="l01288"></a>01288         <a class="code" href="class_public_key.html" title="interface for public keys">PublicKey</a> &amp; AccessPublicKey() {<span class="keywordflow">return</span> m_key;}
<a name="l01289"></a>01289 
<a name="l01290"></a>01290         <span class="comment">// KeyAccessor</span>
<a name="l01291"></a>01291         <span class="keyword">const</span> KEY &amp; GetKey()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_key;}
<a name="l01292"></a>01292         KEY &amp; AccessKey() {<span class="keywordflow">return</span> m_key;}
<a name="l01293"></a>01293 
<a name="l01294"></a>01294 <span class="keyword">protected</span>:
<a name="l01295"></a>01295         <span class="keyword">typename</span> BASE::KeyInterface &amp; AccessKeyInterface() {<span class="keywordflow">return</span> m_key;}
<a name="l01296"></a>01296         <span class="keyword">const</span> <span class="keyword">typename</span> BASE::KeyInterface &amp; GetKeyInterface()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_key;}
<a name="l01297"></a>01297 
<a name="l01298"></a>01298         <span class="comment">// for signature scheme</span>
<a name="l01299"></a>01299         HashIdentifier GetHashIdentifier()<span class="keyword"> const</span>
<a name="l01300"></a>01300 <span class="keyword">        </span>{
<a name="l01301"></a>01301                 <span class="keyword">typedef</span> <span class="keyword">typename</span> SchemeOptions::MessageEncodingMethod::HashIdentifierLookup HashLookup;
<a name="l01302"></a>01302                 <span class="keywordflow">return</span> HashLookup::template HashIdentifierLookup2&lt;CPP_TYPENAME SchemeOptions::HashFunction&gt;::Lookup();
<a name="l01303"></a>01303         }
<a name="l01304"></a>01304         <span class="keywordtype">size_t</span> GetDigestSize()<span class="keyword"> const</span>
<a name="l01305"></a>01305 <span class="keyword">        </span>{
<a name="l01306"></a>01306                 <span class="keyword">typedef</span> CPP_TYPENAME SchemeOptions::HashFunction H;
<a name="l01307"></a>01307                 <span class="keywordflow">return</span> H::DIGESTSIZE;
<a name="l01308"></a>01308         }
<a name="l01309"></a>01309 
<a name="l01310"></a>01310 <span class="keyword">private</span>:
<a name="l01311"></a>01311         KEY m_key;
<a name="l01312"></a>01312 };
<a name="l01313"></a>01313 <span class="comment"></span>
<a name="l01314"></a>01314 <span class="comment">//! _</span>
<a name="l01315"></a>01315 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> BASE, <span class="keyword">class</span> SCHEME_OPTIONS, <span class="keyword">class</span> KEY&gt;
<a name="l01316"></a><a class="code" href="class_d_l___object_impl.html">01316</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_d_l___object_impl.html" title="_">DL_ObjectImpl</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___object_impl_base.html" title="_">DL_ObjectImplBase</a>&lt;BASE, SCHEME_OPTIONS, KEY&gt;
<a name="l01317"></a>01317 {
<a name="l01318"></a>01318 <span class="keyword">public</span>:
<a name="l01319"></a>01319         <span class="keyword">typedef</span> <span class="keyword">typename</span> KEY::Element Element;
<a name="l01320"></a>01320 
<a name="l01321"></a>01321 <span class="keyword">protected</span>:
<a name="l01322"></a>01322         <span class="keyword">const</span> <a class="code" href="class_d_l___elgamal_like_signature_algorithm.html" title="interface for Elgamal-like signature algorithms">DL_ElgamalLikeSignatureAlgorithm&lt;Element&gt;</a> &amp; GetSignatureAlgorithm()<span class="keyword"> const</span>
<a name="l01323"></a>01323 <span class="keyword">                </span>{<span class="keywordflow">return</span> <a class="code" href="class_singleton.html">Singleton&lt;CPP_TYPENAME SCHEME_OPTIONS::SignatureAlgorithm&gt;</a>().Ref();}
<a name="l01324"></a>01324         <span class="keyword">const</span> <a class="code" href="class_d_l___key_agreement_algorithm.html" title="interface for DL key agreement algorithms">DL_KeyAgreementAlgorithm&lt;Element&gt;</a> &amp; GetKeyAgreementAlgorithm()<span class="keyword"> const</span>
<a name="l01325"></a>01325 <span class="keyword">                </span>{<span class="keywordflow">return</span> <a class="code" href="class_singleton.html">Singleton&lt;CPP_TYPENAME SCHEME_OPTIONS::KeyAgreementAlgorithm&gt;</a>().Ref();}
<a name="l01326"></a>01326         <span class="keyword">const</span> <a class="code" href="class_d_l___key_derivation_algorithm.html" title="interface for key derivation algorithms used in DL cryptosystems">DL_KeyDerivationAlgorithm&lt;Element&gt;</a> &amp; GetKeyDerivationAlgorithm()<span class="keyword"> const</span>
<a name="l01327"></a>01327 <span class="keyword">                </span>{<span class="keywordflow">return</span> <a class="code" href="class_singleton.html">Singleton&lt;CPP_TYPENAME SCHEME_OPTIONS::KeyDerivationAlgorithm&gt;</a>().Ref();}
<a name="l01328"></a>01328         <span class="keyword">const</span> <a class="code" href="class_d_l___symmetric_encryption_algorithm.html" title="interface for symmetric encryption algorithms used in DL cryptosystems">DL_SymmetricEncryptionAlgorithm</a> &amp; GetSymmetricEncryptionAlgorithm()<span class="keyword"> const</span>
<a name="l01329"></a>01329 <span class="keyword">                </span>{<span class="keywordflow">return</span> <a class="code" href="class_singleton.html">Singleton&lt;CPP_TYPENAME SCHEME_OPTIONS::SymmetricEncryptionAlgorithm&gt;</a>().Ref();}
<a name="l01330"></a>01330         HashIdentifier GetHashIdentifier()<span class="keyword"> const</span>
<a name="l01331"></a>01331 <span class="keyword">                </span>{<span class="keywordflow">return</span> HashIdentifier();}
<a name="l01332"></a>01332         <span class="keyword">const</span> <a class="code" href="class_p_k___signature_message_encoding_method.html" title="interface for message encoding method for public key signature schemes">PK_SignatureMessageEncodingMethod</a> &amp; GetMessageEncodingInterface()<span class="keyword"> const </span>
<a name="l01333"></a>01333 <span class="keyword">                </span>{<span class="keywordflow">return</span> <a class="code" href="class_singleton.html">Singleton&lt;CPP_TYPENAME SCHEME_OPTIONS::MessageEncodingMethod&gt;</a>().Ref();}
<a name="l01334"></a>01334 };
<a name="l01335"></a>01335 <span class="comment"></span>
<a name="l01336"></a>01336 <span class="comment">//! _</span>
<a name="l01337"></a>01337 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> SCHEME_OPTIONS&gt;
<a name="l01338"></a><a class="code" href="class_d_l___signer_impl.html">01338</a> <span class="keyword">class </span><a class="code" href="class_d_l___signer_impl.html" title="_">DL_SignerImpl</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___object_impl.html" title="_">DL_ObjectImpl</a>&lt;DL_SignerBase&lt;typename SCHEME_OPTIONS::Element&gt;, SCHEME_OPTIONS, typename SCHEME_OPTIONS::PrivateKey&gt;
<a name="l01339"></a>01339 {
<a name="l01340"></a>01340 <span class="keyword">public</span>:
<a name="l01341"></a><a class="code" href="class_d_l___signer_impl.html#aabb709574c6f38f6d5992e88095d4298">01341</a>         <a class="code" href="class_p_k___message_accumulator.html" title="interface for accumulating messages to be signed or verified">PK_MessageAccumulator</a> * NewSignatureAccumulator(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng)<span class="keyword"> const</span>
<a name="l01342"></a>01342 <span class="keyword">        </span>{
<a name="l01343"></a>01343                 std::auto_ptr&lt;PK_MessageAccumulatorBase&gt; p(<span class="keyword">new</span> <a class="code" href="class_p_k___message_accumulator_impl.html">PK_MessageAccumulatorImpl&lt;CPP_TYPENAME SCHEME_OPTIONS::HashFunction&gt;</a>);
<a name="l01344"></a>01344                 this-&gt;RestartMessageAccumulator(rng, *p);
<a name="l01345"></a>01345                 <span class="keywordflow">return</span> p.release();
<a name="l01346"></a>01346         }
<a name="l01347"></a>01347 };
<a name="l01348"></a>01348 <span class="comment"></span>
<a name="l01349"></a>01349 <span class="comment">//! _</span>
<a name="l01350"></a>01350 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> SCHEME_OPTIONS&gt;
<a name="l01351"></a><a class="code" href="class_d_l___verifier_impl.html">01351</a> <span class="keyword">class </span><a class="code" href="class_d_l___verifier_impl.html" title="_">DL_VerifierImpl</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___object_impl.html" title="_">DL_ObjectImpl</a>&lt;DL_VerifierBase&lt;typename SCHEME_OPTIONS::Element&gt;, SCHEME_OPTIONS, typename SCHEME_OPTIONS::PublicKey&gt;
<a name="l01352"></a>01352 {
<a name="l01353"></a>01353 <span class="keyword">public</span>:
<a name="l01354"></a><a class="code" href="class_d_l___verifier_impl.html#a7f28abeb9d19c16334cc9b2530019be8">01354</a>         <a class="code" href="class_p_k___message_accumulator.html" title="interface for accumulating messages to be signed or verified">PK_MessageAccumulator</a> * NewVerificationAccumulator()<span class="keyword"> const</span>
<a name="l01355"></a>01355 <span class="keyword">        </span>{
<a name="l01356"></a>01356                 <span class="keywordflow">return</span> <span class="keyword">new</span> <a class="code" href="class_p_k___message_accumulator_impl.html">PK_MessageAccumulatorImpl&lt;CPP_TYPENAME SCHEME_OPTIONS::HashFunction&gt;</a>;
<a name="l01357"></a>01357         }
<a name="l01358"></a>01358 };
<a name="l01359"></a>01359 <span class="comment"></span>
<a name="l01360"></a>01360 <span class="comment">//! _</span>
<a name="l01361"></a>01361 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> SCHEME_OPTIONS&gt;
<a name="l01362"></a><a class="code" href="class_d_l___encryptor_impl.html">01362</a> <span class="keyword">class </span><a class="code" href="class_d_l___encryptor_impl.html" title="_">DL_EncryptorImpl</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___object_impl.html" title="_">DL_ObjectImpl</a>&lt;DL_EncryptorBase&lt;typename SCHEME_OPTIONS::Element&gt;, SCHEME_OPTIONS, typename SCHEME_OPTIONS::PublicKey&gt;
<a name="l01363"></a>01363 {
<a name="l01364"></a>01364 };
<a name="l01365"></a>01365 <span class="comment"></span>
<a name="l01366"></a>01366 <span class="comment">//! _</span>
<a name="l01367"></a>01367 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> SCHEME_OPTIONS&gt;
<a name="l01368"></a><a class="code" href="class_d_l___decryptor_impl.html">01368</a> <span class="keyword">class </span><a class="code" href="class_d_l___decryptor_impl.html" title="_">DL_DecryptorImpl</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___object_impl.html" title="_">DL_ObjectImpl</a>&lt;DL_DecryptorBase&lt;typename SCHEME_OPTIONS::Element&gt;, SCHEME_OPTIONS, typename SCHEME_OPTIONS::PrivateKey&gt;
<a name="l01369"></a>01369 {
<a name="l01370"></a>01370 };
<a name="l01371"></a>01371 
<a name="l01372"></a>01372 <span class="comment">// ********************************************************</span>
<a name="l01373"></a>01373 <span class="comment"></span>
<a name="l01374"></a>01374 <span class="comment">//! _</span>
<a name="l01375"></a>01375 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> T&gt;
<a name="l01376"></a><a class="code" href="class_d_l___simple_key_agreement_domain_base.html">01376</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_d_l___simple_key_agreement_domain_base.html" title="_">DL_SimpleKeyAgreementDomainBase</a> : <span class="keyword">public</span> <a class="code" href="class_simple_key_agreement_domain.html" title="interface for domains of simple key agreement protocols">SimpleKeyAgreementDomain</a>
<a name="l01377"></a>01377 {
<a name="l01378"></a>01378 <span class="keyword">public</span>:
<a name="l01379"></a>01379         <span class="keyword">typedef</span> T Element;
<a name="l01380"></a>01380 
<a name="l01381"></a>01381         <a class="code" href="class_crypto_parameters.html" title="interface for crypto prameters">CryptoParameters</a> &amp; AccessCryptoParameters() {<span class="keywordflow">return</span> AccessAbstractGroupParameters();}
<a name="l01382"></a><a class="code" href="class_d_l___simple_key_agreement_domain_base.html#a3c106455bfa82eb09e03686c9ad2771a">01382</a>         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_d_l___simple_key_agreement_domain_base.html#a3c106455bfa82eb09e03686c9ad2771a" title="return length of agreed value produced">AgreedValueLength</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> GetAbstractGroupParameters().GetEncodedElementSize(<span class="keyword">false</span>);}
<a name="l01383"></a><a class="code" href="class_d_l___simple_key_agreement_domain_base.html#af91beaef1fe92657a62f53915c6d58c7">01383</a>         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_d_l___simple_key_agreement_domain_base.html#af91beaef1fe92657a62f53915c6d58c7" title="return length of private keys in this domain">PrivateKeyLength</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> GetAbstractGroupParameters().GetSubgroupOrder().ByteCount();}
<a name="l01384"></a><a class="code" href="class_d_l___simple_key_agreement_domain_base.html#aeb0120a4c4170c0c6571e6800d92f2fe">01384</a>         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> <a class="code" href="class_d_l___simple_key_agreement_domain_base.html#aeb0120a4c4170c0c6571e6800d92f2fe" title="return length of public keys in this domain">PublicKeyLength</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> GetAbstractGroupParameters().GetEncodedElementSize(<span class="keyword">true</span>);}
<a name="l01385"></a>01385 
<a name="l01386"></a><a class="code" href="class_d_l___simple_key_agreement_domain_base.html#ad3208753e84fde55582823abdd9922a5">01386</a>         <span class="keywordtype">void</span> GeneratePrivateKey(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, byte *privateKey)<span class="keyword"> const</span>
<a name="l01387"></a>01387 <span class="keyword">        </span>{
<a name="l01388"></a>01388                 <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> x(rng, <a class="code" href="class_integer.html#a8c070592581bf6c2f928c72bfa1c1638" title="avoid calling constructors for these frequently used integers">Integer::One</a>(), GetAbstractGroupParameters().GetMaxExponent());
<a name="l01389"></a>01389                 x.<a class="code" href="class_integer.html#ac12ea467de9a609b86ec03d8cb8837e4" title="encode in big-endian format">Encode</a>(privateKey, PrivateKeyLength());
<a name="l01390"></a>01390         }
<a name="l01391"></a>01391 
<a name="l01392"></a><a class="code" href="class_d_l___simple_key_agreement_domain_base.html#a3e1caeee8c363962a1c766e53f95ef95">01392</a>         <span class="keywordtype">void</span> GeneratePublicKey(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &amp;rng, <span class="keyword">const</span> byte *privateKey, byte *publicKey)<span class="keyword"> const</span>
<a name="l01393"></a>01393 <span class="keyword">        </span>{
<a name="l01394"></a>01394                 <span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;T&gt;</a> &amp;params = GetAbstractGroupParameters();
<a name="l01395"></a>01395                 <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> x(privateKey, PrivateKeyLength());
<a name="l01396"></a>01396                 Element y = params.ExponentiateBase(x);
<a name="l01397"></a>01397                 params.EncodeElement(<span class="keyword">true</span>, y, publicKey);
<a name="l01398"></a>01398         }
<a name="l01399"></a>01399         
<a name="l01400"></a><a class="code" href="class_d_l___simple_key_agreement_domain_base.html#aa27177cea8a872273736e593d1327157">01400</a>         <span class="keywordtype">bool</span> Agree(byte *agreedValue, <span class="keyword">const</span> byte *privateKey, <span class="keyword">const</span> byte *otherPublicKey, <span class="keywordtype">bool</span> validateOtherPublicKey=<span class="keyword">true</span>)<span class="keyword"> const</span>
<a name="l01401"></a>01401 <span class="keyword">        </span>{
<a name="l01402"></a>01402                 <span class="keywordflow">try</span>
<a name="l01403"></a>01403                 {
<a name="l01404"></a>01404                         <span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;T&gt;</a> &amp;params = GetAbstractGroupParameters();
<a name="l01405"></a>01405                         <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> x(privateKey, PrivateKeyLength());
<a name="l01406"></a>01406                         Element w = params.DecodeElement(otherPublicKey, validateOtherPublicKey);
<a name="l01407"></a>01407 
<a name="l01408"></a>01408                         Element z = GetKeyAgreementAlgorithm().AgreeWithStaticPrivateKey(
<a name="l01409"></a>01409                                 GetAbstractGroupParameters(), w, validateOtherPublicKey, x);
<a name="l01410"></a>01410                         params.EncodeElement(<span class="keyword">false</span>, z, agreedValue);
<a name="l01411"></a>01411                 }
<a name="l01412"></a>01412                 <span class="keywordflow">catch</span> (<a class="code" href="class_d_l___bad_element.html" title="to be thrown by DecodeElement and AgreeWithStaticPrivateKey">DL_BadElement</a> &amp;)
<a name="l01413"></a>01413                 {
<a name="l01414"></a>01414                         <span class="keywordflow">return</span> <span class="keyword">false</span>;
<a name="l01415"></a>01415                 }
<a name="l01416"></a>01416                 <span class="keywordflow">return</span> <span class="keyword">true</span>;
<a name="l01417"></a>01417         }
<a name="l01418"></a>01418 
<a name="l01419"></a>01419         <span class="keyword">const</span> Element &amp;GetGenerator()<span class="keyword"> const </span>{<span class="keywordflow">return</span> GetAbstractGroupParameters().GetSubgroupGenerator();}
<a name="l01420"></a>01420 
<a name="l01421"></a>01421 <span class="keyword">protected</span>:
<a name="l01422"></a>01422         <span class="keyword">virtual</span> <span class="keyword">const</span> <a class="code" href="class_d_l___key_agreement_algorithm.html" title="interface for DL key agreement algorithms">DL_KeyAgreementAlgorithm&lt;Element&gt;</a> &amp; GetKeyAgreementAlgorithm() <span class="keyword">const</span> =0;
<a name="l01423"></a>01423         <span class="keyword">virtual</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;Element&gt;</a> &amp; AccessAbstractGroupParameters() =0;
<a name="l01424"></a>01424         <span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;Element&gt;</a> &amp; GetAbstractGroupParameters()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <span class="keyword">const_cast&lt;</span><a class="code" href="class_d_l___simple_key_agreement_domain_base.html" title="_">DL_SimpleKeyAgreementDomainBase&lt;Element&gt;</a> *<span class="keyword">&gt;</span>(<span class="keyword">this</span>)-&gt;AccessAbstractGroupParameters();}
<a name="l01425"></a>01425 };
<a name="l01426"></a>01426 
<a name="l01427"></a>01427 <span class="keyword">enum</span> CofactorMultiplicationOption {NO_COFACTOR_MULTIPLICTION, COMPATIBLE_COFACTOR_MULTIPLICTION, INCOMPATIBLE_COFACTOR_MULTIPLICTION};
<a name="l01428"></a>01428 <span class="keyword">typedef</span> <a class="code" href="struct_enum_to_type.html">EnumToType&lt;CofactorMultiplicationOption, NO_COFACTOR_MULTIPLICTION&gt;</a> <a class="code" href="struct_enum_to_type.html">NoCofactorMultiplication</a>;
<a name="l01429"></a>01429 <span class="keyword">typedef</span> <a class="code" href="struct_enum_to_type.html">EnumToType&lt;CofactorMultiplicationOption, COMPATIBLE_COFACTOR_MULTIPLICTION&gt;</a> <a class="code" href="struct_enum_to_type.html">CompatibleCofactorMultiplication</a>;
<a name="l01430"></a>01430 <span class="keyword">typedef</span> <a class="code" href="struct_enum_to_type.html">EnumToType&lt;CofactorMultiplicationOption, INCOMPATIBLE_COFACTOR_MULTIPLICTION&gt;</a> <a class="code" href="struct_enum_to_type.html">IncompatibleCofactorMultiplication</a>;
<a name="l01431"></a>01431 <span class="comment"></span>
<a name="l01432"></a>01432 <span class="comment">//! DH key agreement algorithm</span>
<a name="l01433"></a>01433 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> ELEMENT, <span class="keyword">class</span> COFACTOR_OPTION&gt;
<a name="l01434"></a><a class="code" href="class_d_l___key_agreement_algorithm___d_h.html">01434</a> <span class="keyword">class </span><a class="code" href="class_d_l___key_agreement_algorithm___d_h.html" title="DH key agreement algorithm.">DL_KeyAgreementAlgorithm_DH</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___key_agreement_algorithm.html" title="interface for DL key agreement algorithms">DL_KeyAgreementAlgorithm</a>&lt;ELEMENT&gt;
<a name="l01435"></a>01435 {
<a name="l01436"></a>01436 <span class="keyword">public</span>:
<a name="l01437"></a>01437         <span class="keyword">typedef</span> ELEMENT Element;
<a name="l01438"></a>01438 
<a name="l01439"></a>01439         <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> * CRYPTOPP_API StaticAlgorithmName()
<a name="l01440"></a>01440                 {<span class="keywordflow">return</span> COFACTOR_OPTION::ToEnum() == INCOMPATIBLE_COFACTOR_MULTIPLICTION ? <span class="stringliteral">&quot;DHC&quot;</span> : <span class="stringliteral">&quot;DH&quot;</span>;}
<a name="l01441"></a>01441 
<a name="l01442"></a>01442         Element AgreeWithEphemeralPrivateKey(<span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;Element&gt;</a> &amp;params, <span class="keyword">const</span> <a class="code" href="class_d_l___fixed_base_precomputation.html">DL_FixedBasePrecomputation&lt;Element&gt;</a> &amp;publicPrecomputation, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;privateExponent)<span class="keyword"> const</span>
<a name="l01443"></a>01443 <span class="keyword">        </span>{
<a name="l01444"></a>01444                 <span class="keywordflow">return</span> publicPrecomputation.Exponentiate(params.GetGroupPrecomputation(), 
<a name="l01445"></a>01445                         COFACTOR_OPTION::ToEnum() == INCOMPATIBLE_COFACTOR_MULTIPLICTION ? privateExponent*params.GetCofactor() : privateExponent);
<a name="l01446"></a>01446         }
<a name="l01447"></a>01447 
<a name="l01448"></a>01448         Element AgreeWithStaticPrivateKey(<span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html" title="interface for DL group parameters">DL_GroupParameters&lt;Element&gt;</a> &amp;params, <span class="keyword">const</span> Element &amp;publicElement, <span class="keywordtype">bool</span> validateOtherPublicKey, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;privateExponent)<span class="keyword"> const</span>
<a name="l01449"></a>01449 <span class="keyword">        </span>{
<a name="l01450"></a>01450                 <span class="keywordflow">if</span> (COFACTOR_OPTION::ToEnum() == COMPATIBLE_COFACTOR_MULTIPLICTION)
<a name="l01451"></a>01451                 {
<a name="l01452"></a>01452                         <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;k = params.GetCofactor();
<a name="l01453"></a>01453                         <span class="keywordflow">return</span> params.ExponentiateElement(publicElement, 
<a name="l01454"></a>01454                                 <a class="code" href="class_modular_arithmetic.html" title="ring of congruence classes modulo n">ModularArithmetic</a>(params.GetSubgroupOrder()).Divide(privateExponent, k)*k);
<a name="l01455"></a>01455                 }
<a name="l01456"></a>01456                 <span class="keywordflow">else</span> <span class="keywordflow">if</span> (COFACTOR_OPTION::ToEnum() == INCOMPATIBLE_COFACTOR_MULTIPLICTION)
<a name="l01457"></a>01457                         <span class="keywordflow">return</span> params.ExponentiateElement(publicElement, privateExponent*params.GetCofactor());
<a name="l01458"></a>01458                 <span class="keywordflow">else</span>
<a name="l01459"></a>01459                 {
<a name="l01460"></a>01460                         assert(COFACTOR_OPTION::ToEnum() == NO_COFACTOR_MULTIPLICTION);
<a name="l01461"></a>01461 
<a name="l01462"></a>01462                         <span class="keywordflow">if</span> (!validateOtherPublicKey)
<a name="l01463"></a>01463                                 <span class="keywordflow">return</span> params.ExponentiateElement(publicElement, privateExponent);
<a name="l01464"></a>01464 
<a name="l01465"></a>01465                         <span class="keywordflow">if</span> (params.FastSubgroupCheckAvailable())
<a name="l01466"></a>01466                         {
<a name="l01467"></a>01467                                 <span class="keywordflow">if</span> (!params.ValidateElement(2, publicElement, NULL))
<a name="l01468"></a>01468                                         <span class="keywordflow">throw</span> <a class="code" href="class_d_l___bad_element.html" title="to be thrown by DecodeElement and AgreeWithStaticPrivateKey">DL_BadElement</a>();
<a name="l01469"></a>01469                                 <span class="keywordflow">return</span> params.ExponentiateElement(publicElement, privateExponent);
<a name="l01470"></a>01470                         }
<a name="l01471"></a>01471                         <span class="keywordflow">else</span>
<a name="l01472"></a>01472                         {
<a name="l01473"></a>01473                                 <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> e[2] = {params.GetSubgroupOrder(), privateExponent};
<a name="l01474"></a>01474                                 Element r[2];
<a name="l01475"></a>01475                                 params.SimultaneousExponentiate(r, publicElement, e, 2);
<a name="l01476"></a>01476                                 <span class="keywordflow">if</span> (!params.IsIdentity(r[0]))
<a name="l01477"></a>01477                                         <span class="keywordflow">throw</span> <a class="code" href="class_d_l___bad_element.html" title="to be thrown by DecodeElement and AgreeWithStaticPrivateKey">DL_BadElement</a>();
<a name="l01478"></a>01478                                 <span class="keywordflow">return</span> r[1];
<a name="l01479"></a>01479                         }
<a name="l01480"></a>01480                 }
<a name="l01481"></a>01481         }
<a name="l01482"></a>01482 };
<a name="l01483"></a>01483 
<a name="l01484"></a>01484 <span class="comment">// ********************************************************</span>
<a name="l01485"></a>01485 <span class="comment"></span>
<a name="l01486"></a>01486 <span class="comment">//! A template implementing constructors for public key algorithm classes</span>
<a name="l01487"></a>01487 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> BASE&gt;
<a name="l01488"></a><a class="code" href="class_p_k___final_template.html">01488</a> <span class="keyword">class </span>CRYPTOPP_NO_VTABLE <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a> : <span class="keyword">public</span> <a class="code" href="class_b_a_s_e.html">BASE</a>
<a name="l01489"></a>01489 {
<a name="l01490"></a>01490 <span class="keyword">public</span>:
<a name="l01491"></a>01491         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>() {}
<a name="l01492"></a>01492 
<a name="l01493"></a>01493         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(<span class="keyword">const</span> <a class="code" href="class_crypto_material.html" title="interface for crypto material, such as public and private keys, and crypto parameters...">CryptoMaterial</a> &amp;key)
<a name="l01494"></a>01494                 {this-&gt;AccessKey().AssignFrom(key);}
<a name="l01495"></a>01495 
<a name="l01496"></a>01496         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;bt)
<a name="l01497"></a>01497                 {this-&gt;AccessKey().BERDecode(bt);}
<a name="l01498"></a>01498 
<a name="l01499"></a>01499         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(<span class="keyword">const</span> <a class="code" href="class_asymmetric_algorithm.html" title="interface for asymmetric algorithms">AsymmetricAlgorithm</a> &amp;algorithm)
<a name="l01500"></a>01500                 {this-&gt;AccessKey().AssignFrom(algorithm.<a class="code" href="class_asymmetric_algorithm.html#adf9cc798c5a2d20ab3436dbad8e6df2d" title="returns a const reference to the crypto material used by this object">GetMaterial</a>());}
<a name="l01501"></a>01501 
<a name="l01502"></a>01502         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;v1)
<a name="l01503"></a>01503                 {this-&gt;AccessKey().Initialize(v1);}
<a name="l01504"></a>01504 
<a name="l01505"></a>01505 <span class="preprocessor">#if (defined(_MSC_VER) &amp;&amp; _MSC_VER &lt; 1300)</span>
<a name="l01506"></a>01506 <span class="preprocessor"></span>
<a name="l01507"></a>01507         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2&gt;
<a name="l01508"></a>01508         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(T1 &amp;v1, T2 &amp;v2)
<a name="l01509"></a>01509                 {this-&gt;AccessKey().Initialize(v1, v2);}
<a name="l01510"></a>01510 
<a name="l01511"></a>01511         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3&gt;
<a name="l01512"></a>01512         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(T1 &amp;v1, T2 &amp;v2, T3 &amp;v3)
<a name="l01513"></a>01513                 {this-&gt;AccessKey().Initialize(v1, v2, v3);}
<a name="l01514"></a>01514         
<a name="l01515"></a>01515         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3, <span class="keyword">class</span> T4&gt;
<a name="l01516"></a>01516         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(T1 &amp;v1, T2 &amp;v2, T3 &amp;v3, T4 &amp;v4)
<a name="l01517"></a>01517                 {this-&gt;AccessKey().Initialize(v1, v2, v3, v4);}
<a name="l01518"></a>01518 
<a name="l01519"></a>01519         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3, <span class="keyword">class</span> T4, <span class="keyword">class</span> T5&gt;
<a name="l01520"></a>01520         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(T1 &amp;v1, T2 &amp;v2, T3 &amp;v3, T4 &amp;v4, T5 &amp;v5)
<a name="l01521"></a>01521                 {this-&gt;AccessKey().Initialize(v1, v2, v3, v4, v5);}
<a name="l01522"></a>01522 
<a name="l01523"></a>01523         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3, <span class="keyword">class</span> T4, <span class="keyword">class</span> T5, <span class="keyword">class</span> T6&gt;
<a name="l01524"></a>01524         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(T1 &amp;v1, T2 &amp;v2, T3 &amp;v3, T4 &amp;v4, T5 &amp;v5, T6 &amp;v6)
<a name="l01525"></a>01525                 {this-&gt;AccessKey().Initialize(v1, v2, v3, v4, v5, v6);}
<a name="l01526"></a>01526 
<a name="l01527"></a>01527         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3, <span class="keyword">class</span> T4, <span class="keyword">class</span> T5, <span class="keyword">class</span> T6, <span class="keyword">class</span> T7&gt;
<a name="l01528"></a>01528         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(T1 &amp;v1, T2 &amp;v2, T3 &amp;v3, T4 &amp;v4, T5 &amp;v5, T6 &amp;v6, T7 &amp;v7)
<a name="l01529"></a>01529                 {this-&gt;AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7);}
<a name="l01530"></a>01530 
<a name="l01531"></a>01531         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3, <span class="keyword">class</span> T4, <span class="keyword">class</span> T5, <span class="keyword">class</span> T6, <span class="keyword">class</span> T7, <span class="keyword">class</span> T8&gt;
<a name="l01532"></a>01532         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(T1 &amp;v1, T2 &amp;v2, T3 &amp;v3, T4 &amp;v4, T5 &amp;v5, T6 &amp;v6, T7 &amp;v7, T8 &amp;v8)
<a name="l01533"></a>01533                 {this-&gt;AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7, v8);}
<a name="l01534"></a>01534 
<a name="l01535"></a>01535 <span class="preprocessor">#else</span>
<a name="l01536"></a>01536 <span class="preprocessor"></span>
<a name="l01537"></a>01537         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2&gt;
<a name="l01538"></a>01538         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(<span class="keyword">const</span> T1 &amp;v1, <span class="keyword">const</span> T2 &amp;v2)
<a name="l01539"></a>01539                 {this-&gt;AccessKey().Initialize(v1, v2);}
<a name="l01540"></a>01540 
<a name="l01541"></a>01541         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3&gt;
<a name="l01542"></a>01542         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(<span class="keyword">const</span> T1 &amp;v1, <span class="keyword">const</span> T2 &amp;v2, <span class="keyword">const</span> T3 &amp;v3)
<a name="l01543"></a>01543                 {this-&gt;AccessKey().Initialize(v1, v2, v3);}
<a name="l01544"></a>01544         
<a name="l01545"></a>01545         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3, <span class="keyword">class</span> T4&gt;
<a name="l01546"></a>01546         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(<span class="keyword">const</span> T1 &amp;v1, <span class="keyword">const</span> T2 &amp;v2, <span class="keyword">const</span> T3 &amp;v3, <span class="keyword">const</span> T4 &amp;v4)
<a name="l01547"></a>01547                 {this-&gt;AccessKey().Initialize(v1, v2, v3, v4);}
<a name="l01548"></a>01548 
<a name="l01549"></a>01549         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3, <span class="keyword">class</span> T4, <span class="keyword">class</span> T5&gt;
<a name="l01550"></a>01550         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(<span class="keyword">const</span> T1 &amp;v1, <span class="keyword">const</span> T2 &amp;v2, <span class="keyword">const</span> T3 &amp;v3, <span class="keyword">const</span> T4 &amp;v4, <span class="keyword">const</span> T5 &amp;v5)
<a name="l01551"></a>01551                 {this-&gt;AccessKey().Initialize(v1, v2, v3, v4, v5);}
<a name="l01552"></a>01552 
<a name="l01553"></a>01553         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3, <span class="keyword">class</span> T4, <span class="keyword">class</span> T5, <span class="keyword">class</span> T6&gt;
<a name="l01554"></a>01554         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(<span class="keyword">const</span> T1 &amp;v1, <span class="keyword">const</span> T2 &amp;v2, <span class="keyword">const</span> T3 &amp;v3, <span class="keyword">const</span> T4 &amp;v4, <span class="keyword">const</span> T5 &amp;v5, <span class="keyword">const</span> T6 &amp;v6)
<a name="l01555"></a>01555                 {this-&gt;AccessKey().Initialize(v1, v2, v3, v4, v5, v6);}
<a name="l01556"></a>01556 
<a name="l01557"></a>01557         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3, <span class="keyword">class</span> T4, <span class="keyword">class</span> T5, <span class="keyword">class</span> T6, <span class="keyword">class</span> T7&gt;
<a name="l01558"></a>01558         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(<span class="keyword">const</span> T1 &amp;v1, <span class="keyword">const</span> T2 &amp;v2, <span class="keyword">const</span> T3 &amp;v3, <span class="keyword">const</span> T4 &amp;v4, <span class="keyword">const</span> T5 &amp;v5, <span class="keyword">const</span> T6 &amp;v6, <span class="keyword">const</span> T7 &amp;v7)
<a name="l01559"></a>01559                 {this-&gt;AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7);}
<a name="l01560"></a>01560 
<a name="l01561"></a>01561         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3, <span class="keyword">class</span> T4, <span class="keyword">class</span> T5, <span class="keyword">class</span> T6, <span class="keyword">class</span> T7, <span class="keyword">class</span> T8&gt;
<a name="l01562"></a>01562         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(<span class="keyword">const</span> T1 &amp;v1, <span class="keyword">const</span> T2 &amp;v2, <span class="keyword">const</span> T3 &amp;v3, <span class="keyword">const</span> T4 &amp;v4, <span class="keyword">const</span> T5 &amp;v5, <span class="keyword">const</span> T6 &amp;v6, <span class="keyword">const</span> T7 &amp;v7, <span class="keyword">const</span> T8 &amp;v8)
<a name="l01563"></a>01563                 {this-&gt;AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7, v8);}
<a name="l01564"></a>01564 
<a name="l01565"></a>01565         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2&gt;
<a name="l01566"></a>01566         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(T1 &amp;v1, <span class="keyword">const</span> T2 &amp;v2)
<a name="l01567"></a>01567                 {this-&gt;AccessKey().Initialize(v1, v2);}
<a name="l01568"></a>01568 
<a name="l01569"></a>01569         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3&gt;
<a name="l01570"></a>01570         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(T1 &amp;v1, <span class="keyword">const</span> T2 &amp;v2, <span class="keyword">const</span> T3 &amp;v3)
<a name="l01571"></a>01571                 {this-&gt;AccessKey().Initialize(v1, v2, v3);}
<a name="l01572"></a>01572         
<a name="l01573"></a>01573         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3, <span class="keyword">class</span> T4&gt;
<a name="l01574"></a>01574         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(T1 &amp;v1, <span class="keyword">const</span> T2 &amp;v2, <span class="keyword">const</span> T3 &amp;v3, <span class="keyword">const</span> T4 &amp;v4)
<a name="l01575"></a>01575                 {this-&gt;AccessKey().Initialize(v1, v2, v3, v4);}
<a name="l01576"></a>01576 
<a name="l01577"></a>01577         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3, <span class="keyword">class</span> T4, <span class="keyword">class</span> T5&gt;
<a name="l01578"></a>01578         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(T1 &amp;v1, <span class="keyword">const</span> T2 &amp;v2, <span class="keyword">const</span> T3 &amp;v3, <span class="keyword">const</span> T4 &amp;v4, <span class="keyword">const</span> T5 &amp;v5)
<a name="l01579"></a>01579                 {this-&gt;AccessKey().Initialize(v1, v2, v3, v4, v5);}
<a name="l01580"></a>01580 
<a name="l01581"></a>01581         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3, <span class="keyword">class</span> T4, <span class="keyword">class</span> T5, <span class="keyword">class</span> T6&gt;
<a name="l01582"></a>01582         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(T1 &amp;v1, <span class="keyword">const</span> T2 &amp;v2, <span class="keyword">const</span> T3 &amp;v3, <span class="keyword">const</span> T4 &amp;v4, <span class="keyword">const</span> T5 &amp;v5, <span class="keyword">const</span> T6 &amp;v6)
<a name="l01583"></a>01583                 {this-&gt;AccessKey().Initialize(v1, v2, v3, v4, v5, v6);}
<a name="l01584"></a>01584 
<a name="l01585"></a>01585         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3, <span class="keyword">class</span> T4, <span class="keyword">class</span> T5, <span class="keyword">class</span> T6, <span class="keyword">class</span> T7&gt;
<a name="l01586"></a>01586         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(T1 &amp;v1, <span class="keyword">const</span> T2 &amp;v2, <span class="keyword">const</span> T3 &amp;v3, <span class="keyword">const</span> T4 &amp;v4, <span class="keyword">const</span> T5 &amp;v5, <span class="keyword">const</span> T6 &amp;v6, <span class="keyword">const</span> T7 &amp;v7)
<a name="l01587"></a>01587                 {this-&gt;AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7);}
<a name="l01588"></a>01588 
<a name="l01589"></a>01589         <span class="keyword">template</span> &lt;<span class="keyword">class</span> T1, <span class="keyword">class</span> T2, <span class="keyword">class</span> T3, <span class="keyword">class</span> T4, <span class="keyword">class</span> T5, <span class="keyword">class</span> T6, <span class="keyword">class</span> T7, <span class="keyword">class</span> T8&gt;
<a name="l01590"></a>01590         <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate</a>(T1 &amp;v1, <span class="keyword">const</span> T2 &amp;v2, <span class="keyword">const</span> T3 &amp;v3, <span class="keyword">const</span> T4 &amp;v4, <span class="keyword">const</span> T5 &amp;v5, <span class="keyword">const</span> T6 &amp;v6, <span class="keyword">const</span> T7 &amp;v7, <span class="keyword">const</span> T8 &amp;v8)
<a name="l01591"></a>01591                 {this-&gt;AccessKey().Initialize(v1, v2, v3, v4, v5, v6, v7, v8);}
<a name="l01592"></a>01592 
<a name="l01593"></a>01593 <span class="preprocessor">#endif</span>
<a name="l01594"></a>01594 <span class="preprocessor"></span>};
<a name="l01595"></a>01595 <span class="comment"></span>
<a name="l01596"></a>01596 <span class="comment">//! Base class for public key encryption standard classes. These classes are used to select from variants of algorithms. Note that not all standards apply to all algorithms.</span>
<a name="l01597"></a><a class="code" href="struct_encryption_standard.html">01597</a> <span class="comment"></span><span class="keyword">struct </span><a class="code" href="struct_encryption_standard.html" title="Base class for public key encryption standard classes. These classes are used to...">EncryptionStandard</a> {};
<a name="l01598"></a>01598 <span class="comment"></span>
<a name="l01599"></a>01599 <span class="comment">//! Base class for public key signature standard classes. These classes are used to select from variants of algorithms. Note that not all standards apply to all algorithms.</span>
<a name="l01600"></a><a class="code" href="struct_signature_standard.html">01600</a> <span class="comment"></span><span class="keyword">struct </span><a class="code" href="struct_signature_standard.html" title="Base class for public key signature standard classes. These classes are used to select...">SignatureStandard</a> {};
<a name="l01601"></a>01601 
<a name="l01602"></a>01602 <span class="keyword">template</span> &lt;<span class="keyword">class</span> STANDARD, <span class="keyword">class</span> KEYS, <span class="keyword">class</span> ALG_INFO&gt;
<a name="l01603"></a>01603 <span class="keyword">class </span><a class="code" href="class_t_f___e_s.html" title="Trapdoor Function Based Encryption Scheme.">TF_ES</a>;
<a name="l01604"></a>01604 <span class="comment"></span>
<a name="l01605"></a>01605 <span class="comment">//! Trapdoor Function Based Encryption Scheme</span>
<a name="l01606"></a>01606 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> STANDARD, <span class="keyword">class</span> KEYS, <span class="keyword">class</span> ALG_INFO = TF_ES&lt;STANDARD, KEYS, <span class="keywordtype">int</span>&gt; &gt;
<a name="l01607"></a><a class="code" href="class_t_f___e_s.html">01607</a> <span class="keyword">class </span><a class="code" href="class_t_f___e_s.html" title="Trapdoor Function Based Encryption Scheme.">TF_ES</a> : <span class="keyword">public</span> KEYS
<a name="l01608"></a>01608 {
<a name="l01609"></a>01609         <span class="keyword">typedef</span> <span class="keyword">typename</span> STANDARD::EncryptionMessageEncodingMethod MessageEncodingMethod;
<a name="l01610"></a>01610 
<a name="l01611"></a>01611 <span class="keyword">public</span>:<span class="comment"></span>
<a name="l01612"></a>01612 <span class="comment">        //! see EncryptionStandard for a list of standards</span>
<a name="l01613"></a><a class="code" href="class_t_f___e_s.html#adcb5b92188770ce5b0274320a86bfb6d">01613</a> <span class="comment"></span>        <span class="keyword">typedef</span> STANDARD Standard;
<a name="l01614"></a>01614         <span class="keyword">typedef</span> <a class="code" href="struct_t_f___crypto_scheme_options.html" title="_">TF_CryptoSchemeOptions&lt;ALG_INFO, KEYS, MessageEncodingMethod&gt;</a> <a class="code" href="struct_t_f___crypto_scheme_options.html" title="_">SchemeOptions</a>;
<a name="l01615"></a>01615 
<a name="l01616"></a>01616         <span class="keyword">static</span> std::string CRYPTOPP_API StaticAlgorithmName() {<span class="keywordflow">return</span> std::string(KEYS::StaticAlgorithmName()) + <span class="stringliteral">&quot;/&quot;</span> + MessageEncodingMethod::StaticAlgorithmName();}
<a name="l01617"></a>01617 <span class="comment"></span>
<a name="l01618"></a>01618 <span class="comment">        //! implements PK_Decryptor interface</span>
<a name="l01619"></a><a class="code" href="class_t_f___e_s.html#a99179d38e5443ff45aa27c13b41104a0">01619</a> <span class="comment"></span>        <span class="keyword">typedef</span> <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate&lt;TF_DecryptorImpl&lt;SchemeOptions&gt;</a> &gt; <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">Decryptor</a>;<span class="comment"></span>
<a name="l01620"></a>01620 <span class="comment">        //! implements PK_Encryptor interface</span>
<a name="l01621"></a><a class="code" href="class_t_f___e_s.html#ad117547c6b1a2479df534db85affebdf">01621</a> <span class="comment"></span>        <span class="keyword">typedef</span> <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate&lt;TF_EncryptorImpl&lt;SchemeOptions&gt;</a> &gt; <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">Encryptor</a>;
<a name="l01622"></a>01622 };
<a name="l01623"></a>01623 
<a name="l01624"></a>01624 <span class="keyword">template</span> &lt;<span class="keyword">class</span> STANDARD, <span class="keyword">class</span> H, <span class="keyword">class</span> KEYS, <span class="keyword">class</span> ALG_INFO&gt;  <span class="comment">// VC60 workaround: doesn&apos;t work if KEYS is first parameter</span>
<a name="l01625"></a>01625 <span class="keyword">class </span><a class="code" href="class_t_f___s_s.html" title="Trapdoor Function Based Signature Scheme.">TF_SS</a>;
<a name="l01626"></a>01626 <span class="comment"></span>
<a name="l01627"></a>01627 <span class="comment">//! Trapdoor Function Based Signature Scheme</span>
<a name="l01628"></a>01628 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> STANDARD, <span class="keyword">class</span> H, <span class="keyword">class</span> KEYS, <span class="keyword">class</span> ALG_INFO = TF_SS&lt;STANDARD, H, KEYS, <span class="keywordtype">int</span>&gt; &gt; <span class="comment">// VC60 workaround: doesn&apos;t work if KEYS is first parameter</span>
<a name="l01629"></a><a class="code" href="class_t_f___s_s.html">01629</a> <span class="keyword">class </span><a class="code" href="class_t_f___s_s.html" title="Trapdoor Function Based Signature Scheme.">TF_SS</a> : <span class="keyword">public</span> KEYS
<a name="l01630"></a>01630 {
<a name="l01631"></a>01631 <span class="keyword">public</span>:<span class="comment"></span>
<a name="l01632"></a>01632 <span class="comment">        //! see SignatureStandard for a list of standards</span>
<a name="l01633"></a><a class="code" href="class_t_f___s_s.html#adfd71a78de97218c16cc74578334345b">01633</a> <span class="comment"></span>        <span class="keyword">typedef</span> STANDARD Standard;
<a name="l01634"></a>01634         <span class="keyword">typedef</span> <span class="keyword">typename</span> Standard::SignatureMessageEncodingMethod MessageEncodingMethod;
<a name="l01635"></a>01635         <span class="keyword">typedef</span> <a class="code" href="struct_t_f___signature_scheme_options.html" title="_">TF_SignatureSchemeOptions&lt;ALG_INFO, KEYS, MessageEncodingMethod, H&gt;</a> <a class="code" href="struct_t_f___signature_scheme_options.html" title="_">SchemeOptions</a>;
<a name="l01636"></a>01636 
<a name="l01637"></a>01637         <span class="keyword">static</span> std::string CRYPTOPP_API StaticAlgorithmName() {<span class="keywordflow">return</span> std::string(KEYS::StaticAlgorithmName()) + <span class="stringliteral">&quot;/&quot;</span> + MessageEncodingMethod::StaticAlgorithmName() + <span class="stringliteral">&quot;(&quot;</span> + H::StaticAlgorithmName() + <span class="stringliteral">&quot;)&quot;</span>;}
<a name="l01638"></a>01638 <span class="comment"></span>
<a name="l01639"></a>01639 <span class="comment">        //! implements PK_Signer interface</span>
<a name="l01640"></a><a class="code" href="class_t_f___s_s.html#acb65955eaffe7bf712815bcc0096e959">01640</a> <span class="comment"></span>        <span class="keyword">typedef</span> <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate&lt;TF_SignerImpl&lt;SchemeOptions&gt;</a> &gt; <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">Signer</a>;<span class="comment"></span>
<a name="l01641"></a>01641 <span class="comment">        //! implements PK_Verifier interface</span>
<a name="l01642"></a><a class="code" href="class_t_f___s_s.html#a65546b9070fbf3960015932defd8b333">01642</a> <span class="comment"></span>        <span class="keyword">typedef</span> <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate&lt;TF_VerifierImpl&lt;SchemeOptions&gt;</a> &gt; <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">Verifier</a>;
<a name="l01643"></a>01643 };
<a name="l01644"></a>01644 
<a name="l01645"></a>01645 <span class="keyword">template</span> &lt;<span class="keyword">class</span> KEYS, <span class="keyword">class</span> SA, <span class="keyword">class</span> MEM, <span class="keyword">class</span> H, <span class="keyword">class</span> ALG_INFO&gt;
<a name="l01646"></a>01646 <span class="keyword">class </span><a class="code" href="class_d_l___s_s.html" title="Discrete Log Based Signature Scheme.">DL_SS</a>;
<a name="l01647"></a>01647 <span class="comment"></span>
<a name="l01648"></a>01648 <span class="comment">//! Discrete Log Based Signature Scheme</span>
<a name="l01649"></a>01649 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> KEYS, <span class="keyword">class</span> SA, <span class="keyword">class</span> MEM, <span class="keyword">class</span> H, <span class="keyword">class</span> ALG_INFO = DL_SS&lt;KEYS, SA, MEM, H, <span class="keywordtype">int</span>&gt; &gt;
<a name="l01650"></a><a class="code" href="class_d_l___s_s.html">01650</a> <span class="keyword">class </span><a class="code" href="class_d_l___s_s.html" title="Discrete Log Based Signature Scheme.">DL_SS</a> : <span class="keyword">public</span> KEYS
<a name="l01651"></a>01651 {
<a name="l01652"></a>01652         <span class="keyword">typedef</span> <a class="code" href="struct_d_l___signature_scheme_options.html" title="_">DL_SignatureSchemeOptions&lt;ALG_INFO, KEYS, SA, MEM, H&gt;</a> <a class="code" href="struct_d_l___signature_scheme_options.html" title="_">SchemeOptions</a>;
<a name="l01653"></a>01653 
<a name="l01654"></a>01654 <span class="keyword">public</span>:
<a name="l01655"></a>01655         <span class="keyword">static</span> std::string StaticAlgorithmName() {<span class="keywordflow">return</span> SA::StaticAlgorithmName() + std::string(<span class="stringliteral">&quot;/EMSA1(&quot;</span>) + H::StaticAlgorithmName() + <span class="stringliteral">&quot;)&quot;</span>;}
<a name="l01656"></a>01656 <span class="comment"></span>
<a name="l01657"></a>01657 <span class="comment">        //! implements PK_Signer interface</span>
<a name="l01658"></a><a class="code" href="class_d_l___s_s.html#a06e7b984899bf56fbd09e62315339c67">01658</a> <span class="comment"></span>        <span class="keyword">typedef</span> <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate&lt;DL_SignerImpl&lt;SchemeOptions&gt;</a> &gt; <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">Signer</a>;<span class="comment"></span>
<a name="l01659"></a>01659 <span class="comment">        //! implements PK_Verifier interface</span>
<a name="l01660"></a><a class="code" href="class_d_l___s_s.html#a82b5f64ffa8f0ebb04743a074e3d201a">01660</a> <span class="comment"></span>        <span class="keyword">typedef</span> <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate&lt;DL_VerifierImpl&lt;SchemeOptions&gt;</a> &gt; <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">Verifier</a>;
<a name="l01661"></a>01661 };
<a name="l01662"></a>01662 <span class="comment"></span>
<a name="l01663"></a>01663 <span class="comment">//! Discrete Log Based Encryption Scheme</span>
<a name="l01664"></a>01664 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> KEYS, <span class="keyword">class</span> AA, <span class="keyword">class</span> DA, <span class="keyword">class</span> EA, <span class="keyword">class</span> ALG_INFO&gt;
<a name="l01665"></a><a class="code" href="class_d_l___e_s.html">01665</a> <span class="keyword">class </span><a class="code" href="class_d_l___e_s.html" title="Discrete Log Based Encryption Scheme.">DL_ES</a> : <span class="keyword">public</span> KEYS
<a name="l01666"></a>01666 {
<a name="l01667"></a>01667         <span class="keyword">typedef</span> <a class="code" href="struct_d_l___crypto_scheme_options.html" title="_">DL_CryptoSchemeOptions&lt;ALG_INFO, KEYS, AA, DA, EA&gt;</a> <a class="code" href="struct_d_l___crypto_scheme_options.html" title="_">SchemeOptions</a>;
<a name="l01668"></a>01668 
<a name="l01669"></a>01669 <span class="keyword">public</span>:<span class="comment"></span>
<a name="l01670"></a>01670 <span class="comment">        //! implements PK_Decryptor interface</span>
<a name="l01671"></a><a class="code" href="class_d_l___e_s.html#a6f4960dec76bc05d9c720c9b903e2a79">01671</a> <span class="comment"></span>        <span class="keyword">typedef</span> <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate&lt;DL_DecryptorImpl&lt;SchemeOptions&gt;</a> &gt; <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">Decryptor</a>;<span class="comment"></span>
<a name="l01672"></a>01672 <span class="comment">        //! implements PK_Encryptor interface</span>
<a name="l01673"></a><a class="code" href="class_d_l___e_s.html#ae0f5a08f99a0ff49d52a4400c58bde76">01673</a> <span class="comment"></span>        <span class="keyword">typedef</span> <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">PK_FinalTemplate&lt;DL_EncryptorImpl&lt;SchemeOptions&gt;</a> &gt; <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">Encryptor</a>;
<a name="l01674"></a>01674 };
<a name="l01675"></a>01675 
<a name="l01676"></a>01676 NAMESPACE_END
<a name="l01677"></a>01677 
<a name="l01678"></a>01678 <span class="preprocessor">#endif</span>
</pre></div></div>
<hr size="1"/><address style="text-align: right;"><small>Generated on 9 Dec 2009 for Crypto++ by&nbsp;
<a href="http://www.doxygen.org/index.html">
<img class="footer" src="doxygen.png" alt="doxygen"/></a> 1.6.1 </small></address>
</body>
</html>