Sophie

Sophie

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

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++: luc.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>luc.h</h1><a href="luc_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre class="fragment"><a name="l00001"></a>00001 <span class="preprocessor">#ifndef CRYPTOPP_LUC_H</span>
<a name="l00002"></a>00002 <span class="preprocessor"></span><span class="preprocessor">#define CRYPTOPP_LUC_H</span>
<a name="l00003"></a>00003 <span class="preprocessor"></span><span class="comment"></span>
<a name="l00004"></a>00004 <span class="comment">/** \file</span>
<a name="l00005"></a>00005 <span class="comment">*/</span>
<a name="l00006"></a>00006 
<a name="l00007"></a>00007 <span class="preprocessor">#include &quot;pkcspad.h&quot;</span>
<a name="l00008"></a>00008 <span class="preprocessor">#include &quot;oaep.h&quot;</span>
<a name="l00009"></a>00009 <span class="preprocessor">#include &quot;<a class="code" href="integer_8h.html">integer.h</a>&quot;</span>
<a name="l00010"></a>00010 <span class="preprocessor">#include &quot;<a class="code" href="dh_8h.html">dh.h</a>&quot;</span>
<a name="l00011"></a>00011 
<a name="l00012"></a>00012 <span class="preprocessor">#include &lt;limits.h&gt;</span>
<a name="l00013"></a>00013 
<a name="l00014"></a>00014 NAMESPACE_BEGIN(CryptoPP)
<a name="l00015"></a>00015 
<a name="l00016"></a>00016 <span class="comment">//! The LUC function.</span>
<a name="l00017"></a>00017 <span class="comment"></span><span class="comment">/*! This class is here for historical and pedagogical interest. It has no</span>
<a name="l00018"></a>00018 <span class="comment">        practical advantages over other trapdoor functions and probably shouldn&apos;t</span>
<a name="l00019"></a>00019 <span class="comment">        be used in production software. The discrete log based LUC schemes</span>
<a name="l00020"></a>00020 <span class="comment">        defined later in this .h file may be of more practical interest.</span>
<a name="l00021"></a>00021 <span class="comment">*/</span>
<a name="l00022"></a><a class="code" href="class_l_u_c_function.html">00022</a> class <a class="code" href="class_l_u_c_function.html" title="The LUC function.">LUCFunction</a> : public <a class="code" href="class_trapdoor_function.html" title="_">TrapdoorFunction</a>, public <a class="code" href="class_public_key.html" title="interface for public keys">PublicKey</a>
<a name="l00023"></a>00023 {
<a name="l00024"></a>00024         <span class="keyword">typedef</span> <a class="code" href="class_l_u_c_function.html" title="The LUC function.">LUCFunction</a> <a class="code" href="class_l_u_c_function.html" title="The LUC function.">ThisClass</a>;
<a name="l00025"></a>00025 
<a name="l00026"></a>00026 <span class="keyword">public</span>:
<a name="l00027"></a>00027         <span class="keywordtype">void</span> Initialize(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;n, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;e)
<a name="l00028"></a>00028                 {m_n = n; m_e = e;}
<a name="l00029"></a>00029 
<a name="l00030"></a>00030         <span class="keywordtype">void</span> BERDecode(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;bt);
<a name="l00031"></a>00031         <span class="keywordtype">void</span> DEREncode(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;bt) <span class="keyword">const</span>;
<a name="l00032"></a>00032 
<a name="l00033"></a>00033         <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>;
<a name="l00034"></a>00034         <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> PreimageBound()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_n;}
<a name="l00035"></a>00035         <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> ImageBound()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_n;}
<a name="l00036"></a>00036 
<a name="l00037"></a>00037         <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="l00038"></a>00038         <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="l00039"></a>00039         <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="l00040"></a>00040 
<a name="l00041"></a>00041         <span class="comment">// non-derived interface</span>
<a name="l00042"></a>00042         <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp; GetModulus()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_n;}
<a name="l00043"></a>00043         <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp; GetPublicExponent()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_e;}
<a name="l00044"></a>00044 
<a name="l00045"></a>00045         <span class="keywordtype">void</span> SetModulus(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;n) {m_n = n;}
<a name="l00046"></a>00046         <span class="keywordtype">void</span> SetPublicExponent(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;e) {m_e = e;}
<a name="l00047"></a>00047 
<a name="l00048"></a>00048 <span class="keyword">protected</span>:
<a name="l00049"></a>00049         <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> m_n, m_e;
<a name="l00050"></a>00050 };
<a name="l00051"></a>00051 <span class="comment"></span>
<a name="l00052"></a>00052 <span class="comment">//! _</span>
<a name="l00053"></a><a class="code" href="class_invertible_l_u_c_function.html">00053</a> <span class="comment"></span><span class="keyword">class </span><a class="code" href="class_invertible_l_u_c_function.html" title="_">InvertibleLUCFunction</a> : <span class="keyword">public</span> <a class="code" href="class_l_u_c_function.html" title="The LUC function.">LUCFunction</a>, <span class="keyword">public</span> <a class="code" href="class_trapdoor_function_inverse.html" title="_">TrapdoorFunctionInverse</a>, <span class="keyword">public</span> <a class="code" href="class_private_key.html" title="interface for private keys">PrivateKey</a>
<a name="l00054"></a>00054 {
<a name="l00055"></a>00055         <span class="keyword">typedef</span> <a class="code" href="class_invertible_l_u_c_function.html" title="_">InvertibleLUCFunction</a> <a class="code" href="class_l_u_c_function.html" title="The LUC function.">ThisClass</a>;
<a name="l00056"></a>00056 
<a name="l00057"></a>00057 <span class="keyword">public</span>:
<a name="l00058"></a>00058         <span class="keywordtype">void</span> Initialize(<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> modulusBits, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;eStart=17);
<a name="l00059"></a>00059         <span class="keywordtype">void</span> Initialize(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;n, <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;p, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;q, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;u)
<a name="l00060"></a>00060                 {m_n = n; m_e = e; m_p = p; m_q = q; m_u = u;}
<a name="l00061"></a>00061 
<a name="l00062"></a>00062         <span class="keywordtype">void</span> BERDecode(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;bt);
<a name="l00063"></a>00063         <span class="keywordtype">void</span> DEREncode(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;bt) <span class="keyword">const</span>;
<a name="l00064"></a>00064 
<a name="l00065"></a>00065         <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>;
<a name="l00066"></a>00066 
<a name="l00067"></a>00067         <span class="keywordtype">bool</span> <a class="code" href="class_invertible_l_u_c_function.html#ad6390a95a003eceef45cc238f538c4d8" 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="l00068"></a>00068         <span class="keywordtype">bool</span> <a class="code" href="class_invertible_l_u_c_function.html#a882c26c94e15ecb1added6f3fafae021" 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="l00069"></a>00069         <span class="keywordtype">void</span> <a class="code" href="class_invertible_l_u_c_function.html#aaaef1b335de1f76ec61079d1dfd78744" title="assign values from source to this object">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);<span class="comment"></span>
<a name="l00070"></a>00070 <span class="comment">        /*! parameters: (ModulusSize, PublicExponent (default 17)) */</span>
<a name="l00071"></a>00071         <span class="keywordtype">void</span> <a class="code" href="class_invertible_l_u_c_function.html#af846ecc0f5e8d17267544920bc39f233">GenerateRandom</a>(<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;alg);
<a name="l00072"></a>00072 
<a name="l00073"></a>00073         <span class="comment">// non-derived interface</span>
<a name="l00074"></a>00074         <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp; GetPrime1()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_p;}
<a name="l00075"></a>00075         <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp; GetPrime2()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_q;}
<a name="l00076"></a>00076         <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>&amp; GetMultiplicativeInverseOfPrime2ModPrime1()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_u;}
<a name="l00077"></a>00077 
<a name="l00078"></a>00078         <span class="keywordtype">void</span> SetPrime1(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;p) {m_p = p;}
<a name="l00079"></a>00079         <span class="keywordtype">void</span> SetPrime2(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;q) {m_q = q;}
<a name="l00080"></a>00080         <span class="keywordtype">void</span> SetMultiplicativeInverseOfPrime2ModPrime1(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;u) {m_u = u;}
<a name="l00081"></a>00081 
<a name="l00082"></a>00082 <span class="keyword">protected</span>:
<a name="l00083"></a>00083         <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> m_p, m_q, m_u;
<a name="l00084"></a>00084 };
<a name="l00085"></a>00085 
<a name="l00086"></a><a class="code" href="struct_l_u_c.html">00086</a> <span class="keyword">struct </span><a class="code" href="struct_l_u_c.html">LUC</a>
<a name="l00087"></a>00087 {
<a name="l00088"></a>00088         <span class="keyword">static</span> std::string StaticAlgorithmName() {<span class="keywordflow">return</span> <span class="stringliteral">&quot;LUC&quot;</span>;}
<a name="l00089"></a>00089         <span class="keyword">typedef</span> <a class="code" href="class_l_u_c_function.html" title="The LUC function.">LUCFunction</a> <a class="code" href="class_l_u_c_function.html" title="The LUC function.">PublicKey</a>;
<a name="l00090"></a>00090         <span class="keyword">typedef</span> <a class="code" href="class_invertible_l_u_c_function.html" title="_">InvertibleLUCFunction</a> <a class="code" href="class_invertible_l_u_c_function.html" title="_">PrivateKey</a>;
<a name="l00091"></a>00091 };
<a name="l00092"></a>00092 <span class="comment"></span>
<a name="l00093"></a>00093 <span class="comment">//! LUC cryptosystem</span>
<a name="l00094"></a>00094 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> STANDARD&gt;
<a name="l00095"></a><a class="code" href="struct_l_u_c_e_s.html">00095</a> <span class="keyword">struct </span><a class="code" href="struct_l_u_c_e_s.html" title="LUC cryptosystem.">LUCES</a> : <span class="keyword">public</span> <a class="code" href="class_t_f___e_s.html" title="Trapdoor Function Based Encryption Scheme.">TF_ES</a>&lt;STANDARD, LUC&gt;
<a name="l00096"></a>00096 {
<a name="l00097"></a>00097 };
<a name="l00098"></a>00098 <span class="comment"></span>
<a name="l00099"></a>00099 <span class="comment">//! LUC signature scheme with appendix</span>
<a name="l00100"></a>00100 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> STANDARD, <span class="keyword">class</span> H&gt;
<a name="l00101"></a><a class="code" href="struct_l_u_c_s_s.html">00101</a> <span class="keyword">struct </span><a class="code" href="struct_l_u_c_s_s.html" title="LUC signature scheme with appendix.">LUCSS</a> : <span class="keyword">public</span> <a class="code" href="class_t_f___s_s.html" title="Trapdoor Function Based Signature Scheme.">TF_SS</a>&lt;STANDARD, H, LUC&gt;
<a name="l00102"></a>00102 {
<a name="l00103"></a>00103 };
<a name="l00104"></a>00104 
<a name="l00105"></a>00105 <span class="comment">// analagous to the RSA schemes defined in PKCS #1 v2.0</span>
<a name="l00106"></a>00106 <span class="keyword">typedef</span> <a class="code" href="struct_l_u_c_e_s.html" title="LUC cryptosystem.">LUCES&lt;OAEP&lt;SHA&gt;</a> &gt;::Decryptor <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">LUCES_OAEP_SHA_Decryptor</a>;
<a name="l00107"></a>00107 <span class="keyword">typedef</span> <a class="code" href="struct_l_u_c_e_s.html" title="LUC cryptosystem.">LUCES&lt;OAEP&lt;SHA&gt;</a> &gt;::Encryptor <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">LUCES_OAEP_SHA_Encryptor</a>;
<a name="l00108"></a>00108 
<a name="l00109"></a>00109 <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.">LUCSS&lt;PKCS1v15, SHA&gt;::Signer</a> <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">LUCSSA_PKCS1v15_SHA_Signer</a>;
<a name="l00110"></a>00110 <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.">LUCSS&lt;PKCS1v15, SHA&gt;::Verifier</a> <a class="code" href="class_p_k___final_template.html" title="A template implementing constructors for public key algorithm classes.">LUCSSA_PKCS1v15_SHA_Verifier</a>;
<a name="l00111"></a>00111 
<a name="l00112"></a>00112 <span class="comment">// ********************************************************</span>
<a name="l00113"></a>00113 
<a name="l00114"></a>00114 <span class="comment">// no actual precomputation</span>
<a name="l00115"></a><a class="code" href="class_d_l___group_precomputation___l_u_c.html">00115</a> <span class="keyword">class </span><a class="code" href="class_d_l___group_precomputation___l_u_c.html">DL_GroupPrecomputation_LUC</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___group_precomputation.html">DL_GroupPrecomputation</a>&lt;Integer&gt;
<a name="l00116"></a>00116 {
<a name="l00117"></a>00117 <span class="keyword">public</span>:
<a name="l00118"></a>00118         <span class="keyword">const</span> <a class="code" href="class_abstract_group.html" title="Abstract Group.">AbstractGroup&lt;Element&gt;</a> &amp; GetGroup()<span class="keyword"> const </span>{assert(<span class="keyword">false</span>); <span class="keywordflow">throw</span> 0;}
<a name="l00119"></a>00119         <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Element</a> BERDecodeElement(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;bt)<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>(bt);}
<a name="l00120"></a>00120         <span class="keywordtype">void</span> DEREncodeElement(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;bt, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Element</a> &amp;v)<span class="keyword"> const </span>{v.<a class="code" href="class_integer.html#a6ab51a05bee88cfa690179611e8a084e" title="encode using Distinguished Encoding Rules, put result into a BufferedTransformation...">DEREncode</a>(bt);}
<a name="l00121"></a>00121 
<a name="l00122"></a>00122         <span class="comment">// non-inherited</span>
<a name="l00123"></a>00123         <span class="keywordtype">void</span> SetModulus(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;v) {m_p = v;}
<a name="l00124"></a>00124         <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp; GetModulus()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_p;}
<a name="l00125"></a>00125 
<a name="l00126"></a>00126 <span class="keyword">private</span>:
<a name="l00127"></a>00127         <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> m_p;
<a name="l00128"></a>00128 };
<a name="l00129"></a>00129 <span class="comment"></span>
<a name="l00130"></a>00130 <span class="comment">//! _</span>
<a name="l00131"></a><a class="code" href="class_d_l___base_precomputation___l_u_c.html">00131</a> <span class="comment"></span><span class="keyword">class </span><a class="code" href="class_d_l___base_precomputation___l_u_c.html" title="_">DL_BasePrecomputation_LUC</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___fixed_base_precomputation.html">DL_FixedBasePrecomputation</a>&lt;Integer&gt;
<a name="l00132"></a>00132 {
<a name="l00133"></a>00133 <span class="keyword">public</span>:
<a name="l00134"></a>00134         <span class="comment">// DL_FixedBasePrecomputation</span>
<a name="l00135"></a>00135         <span class="keywordtype">bool</span> IsInitialized()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_g.NotZero();}
<a name="l00136"></a>00136         <span class="keywordtype">void</span> SetBase(<span class="keyword">const</span> <a class="code" href="class_d_l___group_precomputation.html">DL_GroupPrecomputation&lt;Element&gt;</a> &amp;group, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;base) {m_g = base;}
<a name="l00137"></a>00137         <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp; GetBase(<span class="keyword">const</span> <a class="code" href="class_d_l___group_precomputation.html">DL_GroupPrecomputation&lt;Element&gt;</a> &amp;group)<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_g;}
<a name="l00138"></a>00138         <span class="keywordtype">void</span> Precompute(<span class="keyword">const</span> <a class="code" href="class_d_l___group_precomputation.html">DL_GroupPrecomputation&lt;Element&gt;</a> &amp;group, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> maxExpBits, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> storage) {}
<a name="l00139"></a>00139         <span class="keywordtype">void</span> Load(<span class="keyword">const</span> <a class="code" href="class_d_l___group_precomputation.html">DL_GroupPrecomputation&lt;Element&gt;</a> &amp;group, <a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;storedPrecomputation) {}
<a name="l00140"></a>00140         <span class="keywordtype">void</span> Save(<span class="keyword">const</span> <a class="code" href="class_d_l___group_precomputation.html">DL_GroupPrecomputation&lt;Element&gt;</a> &amp;group, <a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &amp;storedPrecomputation)<span class="keyword"> const </span>{}
<a name="l00141"></a>00141         <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> Exponentiate(<span class="keyword">const</span> <a class="code" href="class_d_l___group_precomputation.html">DL_GroupPrecomputation&lt;Element&gt;</a> &amp;group, <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="l00142"></a>00142         <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> CascadeExponentiate(<span class="keyword">const</span> <a class="code" href="class_d_l___group_precomputation.html">DL_GroupPrecomputation&lt;Element&gt;</a> &amp;group, <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 class="code" href="class_d_l___fixed_base_precomputation.html">DL_FixedBasePrecomputation&lt;Integer&gt;</a> &amp;pc2, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;exponent2)<span class="keyword"> const</span>
<a name="l00143"></a>00143 <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_BasePrecomputation_LUC: CascadeExponentiate not implemented&quot;</span>);}       <span class="comment">// shouldn&apos;t be called</span>
<a name="l00144"></a>00144 
<a name="l00145"></a>00145 <span class="keyword">private</span>:
<a name="l00146"></a>00146         <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> m_g;
<a name="l00147"></a>00147 };
<a name="l00148"></a>00148 <span class="comment"></span>
<a name="l00149"></a>00149 <span class="comment">//! _</span>
<a name="l00150"></a><a class="code" href="class_d_l___group_parameters___l_u_c.html">00150</a> <span class="comment"></span><span class="keyword">class </span><a class="code" href="class_d_l___group_parameters___l_u_c.html" title="_">DL_GroupParameters_LUC</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___group_parameters___integer_based_impl.html" title="_">DL_GroupParameters_IntegerBasedImpl</a>&lt;DL_GroupPrecomputation_LUC, DL_BasePrecomputation_LUC&gt;
<a name="l00151"></a>00151 {
<a name="l00152"></a>00152 <span class="keyword">public</span>:
<a name="l00153"></a>00153         <span class="comment">// DL_GroupParameters</span>
<a name="l00154"></a>00154         <span class="keywordtype">bool</span> IsIdentity(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;element)<span class="keyword"> const </span>{<span class="keywordflow">return</span> element == <a class="code" href="class_integer.html#af0cb74a45a48e677952166bdac9d82d7" title="avoid calling constructors for these frequently used integers">Integer::Two</a>();}
<a name="l00155"></a>00155         <span class="keywordtype">void</span> SimultaneousExponentiate(<a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Element</a> *results, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Element</a> &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>;
<a name="l00156"></a>00156         <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Element</a> MultiplyElements(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Element</a> &amp;a, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Element</a> &amp;b)<span class="keyword"> const</span>
<a name="l00157"></a>00157 <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;LUC_GroupParameters: MultiplyElements can not be implemented&quot;</span>);}
<a name="l00158"></a>00158         <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Element</a> CascadeExponentiate(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Element</a> &amp;element1, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;exponent1, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Element</a> &amp;element2, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &amp;exponent2)<span class="keyword"> const</span>
<a name="l00159"></a>00159 <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;LUC_GroupParameters: MultiplyElements can not be implemented&quot;</span>);}
<a name="l00160"></a>00160 
<a name="l00161"></a>00161         <span class="comment">// NameValuePairs interface</span>
<a name="l00162"></a><a class="code" href="class_d_l___group_parameters___l_u_c.html#a1fe69d1b816aafccc929ac5f17148330">00162</a>         <span class="keywordtype">bool</span> <a class="code" href="class_d_l___group_parameters___l_u_c.html#a1fe69d1b816aafccc929ac5f17148330" 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="l00163"></a>00163 <span class="keyword">        </span>{
<a name="l00164"></a>00164                 <span class="keywordflow">return</span> GetValueHelper&lt;DL_GroupParameters_IntegerBased&gt;(<span class="keyword">this</span>, name, valueType, pValue).Assignable();
<a name="l00165"></a>00165         }
<a name="l00166"></a>00166 
<a name="l00167"></a>00167 <span class="keyword">private</span>:
<a name="l00168"></a>00168         <span class="keywordtype">int</span> GetFieldType()<span class="keyword"> const </span>{<span class="keywordflow">return</span> 2;}
<a name="l00169"></a>00169 };
<a name="l00170"></a>00170 <span class="comment"></span>
<a name="l00171"></a>00171 <span class="comment">//! _</span>
<a name="l00172"></a><a class="code" href="class_d_l___group_parameters___l_u_c___default_safe_prime.html">00172</a> <span class="comment"></span><span class="keyword">class </span><a class="code" href="class_d_l___group_parameters___l_u_c___default_safe_prime.html" title="_">DL_GroupParameters_LUC_DefaultSafePrime</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___group_parameters___l_u_c.html" title="_">DL_GroupParameters_LUC</a>
<a name="l00173"></a>00173 {
<a name="l00174"></a>00174 <span class="keyword">public</span>:
<a name="l00175"></a>00175         <span class="keyword">typedef</span> <a class="code" href="struct_enum_to_type.html">NoCofactorMultiplication</a> <a class="code" href="struct_enum_to_type.html">DefaultCofactorOption</a>;
<a name="l00176"></a>00176 
<a name="l00177"></a>00177 <span class="keyword">protected</span>:
<a name="l00178"></a>00178         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> GetDefaultSubgroupOrderSize(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> modulusSize)<span class="keyword"> const </span>{<span class="keywordflow">return</span> modulusSize-1;}
<a name="l00179"></a>00179 };
<a name="l00180"></a>00180 <span class="comment"></span>
<a name="l00181"></a>00181 <span class="comment">//! _</span>
<a name="l00182"></a><a class="code" href="class_d_l___algorithm___l_u_c___h_m_p.html">00182</a> <span class="comment"></span><span class="keyword">class </span><a class="code" href="class_d_l___algorithm___l_u_c___h_m_p.html" title="_">DL_Algorithm_LUC_HMP</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___elgamal_like_signature_algorithm.html" title="interface for Elgamal-like signature algorithms">DL_ElgamalLikeSignatureAlgorithm</a>&lt;Integer&gt;
<a name="l00183"></a>00183 {
<a name="l00184"></a>00184 <span class="keyword">public</span>:
<a name="l00185"></a>00185         <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> * StaticAlgorithmName() {<span class="keywordflow">return</span> <span class="stringliteral">&quot;LUC-HMP&quot;</span>;}
<a name="l00186"></a>00186 
<a name="l00187"></a>00187         <span class="keywordtype">void</span> Sign(<span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html">DL_GroupParameters&lt;Integer&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;x, <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="l00188"></a>00188         <span class="keywordtype">bool</span> Verify(<span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html">DL_GroupParameters&lt;Integer&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;Integer&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>;
<a name="l00189"></a>00189 
<a name="l00190"></a>00190         <span class="keywordtype">size_t</span> RLen(<span class="keyword">const</span> <a class="code" href="class_d_l___group_parameters.html">DL_GroupParameters&lt;Integer&gt;</a> &amp;params)<span class="keyword"> const</span>
<a name="l00191"></a>00191 <span class="keyword">                </span>{<span class="keywordflow">return</span> params.GetGroupOrder().<a class="code" href="class_integer.html#aea4f2d31725ab02c67d9ea0288767670" title="number of significant bytes = ceiling(BitCount()/8)">ByteCount</a>();}
<a name="l00192"></a>00192 };
<a name="l00193"></a>00193 <span class="comment"></span>
<a name="l00194"></a>00194 <span class="comment">//! _</span>
<a name="l00195"></a><a class="code" href="struct_d_l___signature_keys___l_u_c.html">00195</a> <span class="comment"></span><span class="keyword">struct </span><a class="code" href="struct_d_l___signature_keys___l_u_c.html" title="_">DL_SignatureKeys_LUC</a>
<a name="l00196"></a>00196 {
<a name="l00197"></a>00197         <span class="keyword">typedef</span> <a class="code" href="class_d_l___group_parameters___l_u_c.html" title="_">DL_GroupParameters_LUC</a> <a class="code" href="class_d_l___group_parameters___l_u_c.html" title="_">GroupParameters</a>;
<a name="l00198"></a>00198         <span class="keyword">typedef</span> <a class="code" href="class_d_l___public_key___g_f_p.html">DL_PublicKey_GFP&lt;GroupParameters&gt;</a> <a class="code" href="class_d_l___public_key___g_f_p.html">PublicKey</a>;
<a name="l00199"></a>00199         <span class="keyword">typedef</span> <a class="code" href="class_d_l___private_key___g_f_p.html" title="DL private key (in GF(p) groups).">DL_PrivateKey_GFP&lt;GroupParameters&gt;</a> <a class="code" href="class_d_l___private_key___g_f_p.html" title="DL private key (in GF(p) groups).">PrivateKey</a>;
<a name="l00200"></a>00200 };
<a name="l00201"></a>00201 <span class="comment"></span>
<a name="l00202"></a>00202 <span class="comment">//! LUC-HMP, based on &quot;Digital signature schemes based on Lucas functions&quot; by Patrick Horster, Markus Michels, Holger Petersen</span>
<a name="l00203"></a>00203 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> H&gt;
<a name="l00204"></a><a class="code" href="struct_l_u_c___h_m_p.html">00204</a> <span class="keyword">struct </span><a class="code" href="struct_l_u_c___h_m_p.html" title="LUC-HMP, based on &amp;quot;Digital signature schemes based on Lucas functions&amp;quot;...">LUC_HMP</a> : <span class="keyword">public</span> <a class="code" href="class_d_l___s_s.html" title="Discrete Log Based Signature Scheme.">DL_SS</a>&lt;DL_SignatureKeys_LUC, DL_Algorithm_LUC_HMP, DL_SignatureMessageEncodingMethod_DSA, H&gt;
<a name="l00205"></a>00205 {
<a name="l00206"></a>00206 };
<a name="l00207"></a>00207 <span class="comment"></span>
<a name="l00208"></a>00208 <span class="comment">//! _</span>
<a name="l00209"></a><a class="code" href="struct_d_l___crypto_keys___l_u_c.html">00209</a> <span class="comment"></span><span class="keyword">struct </span><a class="code" href="struct_d_l___crypto_keys___l_u_c.html" title="_">DL_CryptoKeys_LUC</a>
<a name="l00210"></a>00210 {
<a name="l00211"></a>00211         <span class="keyword">typedef</span> <a class="code" href="class_d_l___group_parameters___l_u_c___default_safe_prime.html" title="_">DL_GroupParameters_LUC_DefaultSafePrime</a> <a class="code" href="class_d_l___group_parameters___l_u_c___default_safe_prime.html" title="_">GroupParameters</a>;
<a name="l00212"></a>00212         <span class="keyword">typedef</span> <a class="code" href="class_d_l___public_key___g_f_p.html">DL_PublicKey_GFP&lt;GroupParameters&gt;</a> <a class="code" href="class_d_l___public_key___g_f_p.html">PublicKey</a>;
<a name="l00213"></a>00213         <span class="keyword">typedef</span> <a class="code" href="class_d_l___private_key___g_f_p.html" title="DL private key (in GF(p) groups).">DL_PrivateKey_GFP&lt;GroupParameters&gt;</a> <a class="code" href="class_d_l___private_key___g_f_p.html" title="DL private key (in GF(p) groups).">PrivateKey</a>;
<a name="l00214"></a>00214 };
<a name="l00215"></a>00215 <span class="comment"></span>
<a name="l00216"></a>00216 <span class="comment">//! LUC-IES</span>
<a name="l00217"></a>00217 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> COFACTOR_OPTION = NoCofactorMultiplication, <span class="keywordtype">bool</span> DHAES_MODE = true&gt;
<a name="l00218"></a><a class="code" href="struct_l_u_c___i_e_s.html">00218</a> <span class="keyword">struct </span><a class="code" href="struct_l_u_c___i_e_s.html" title="LUC-IES.">LUC_IES</a>
<a name="l00219"></a>00219         : <span class="keyword">public</span> <a class="code" href="class_d_l___e_s.html" title="Discrete Log Based Encryption Scheme.">DL_ES</a>&lt;
<a name="l00220"></a>00220                 DL_CryptoKeys_LUC,
<a name="l00221"></a>00221                 DL_KeyAgreementAlgorithm_DH&lt;Integer, COFACTOR_OPTION&gt;,
<a name="l00222"></a>00222                 DL_KeyDerivationAlgorithm_P1363&lt;Integer, DHAES_MODE, P1363_KDF2&lt;SHA1&gt; &gt;,
<a name="l00223"></a>00223                 DL_EncryptionAlgorithm_Xor&lt;HMAC&lt;SHA1&gt;, DHAES_MODE&gt;,
<a name="l00224"></a>00224                 LUC_IES&lt;&gt; &gt;
<a name="l00225"></a>00225 {
<a name="l00226"></a>00226         <span class="keyword">static</span> std::string StaticAlgorithmName() {<span class="keywordflow">return</span> <span class="stringliteral">&quot;LUC-IES&quot;</span>;}    <span class="comment">// non-standard name</span>
<a name="l00227"></a>00227 };
<a name="l00228"></a>00228 
<a name="l00229"></a>00229 <span class="comment">// ********************************************************</span>
<a name="l00230"></a>00230 <span class="comment"></span>
<a name="l00231"></a>00231 <span class="comment">//! LUC-DH</span>
<a name="l00232"></a><a class="code" href="luc_8h.html#ab2c863cff24e8c956e82635d3f7c0ffb">00232</a> <span class="comment"></span><span class="keyword">typedef</span> <a class="code" href="class_d_h___domain.html" title=",">DH_Domain&lt;DL_GroupParameters_LUC_DefaultSafePrime&gt;</a> <a class="code" href="class_d_h___domain.html" title=",">LUC_DH</a>;
<a name="l00233"></a>00233 
<a name="l00234"></a>00234 NAMESPACE_END
<a name="l00235"></a>00235 
<a name="l00236"></a>00236 <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>