📄 esign_8h-source.html
字号:
<a name="l00058"></a>00058 {<a class="code" href="class_e_s_i_g_n_function.html#74695389e40c412ff0a1e34ebb797678">m_n</a> = n; <a class="code" href="class_e_s_i_g_n_function.html#086e17e8047753768b22c6b59faebf60">m_e</a> = e; <a class="code" href="class_invertible_e_s_i_g_n_function.html#d743ae7fe10fbff6c9dddd88e76fc7fd">m_p</a> = p; <a class="code" href="class_invertible_e_s_i_g_n_function.html#dc2b3dc52e2421e408f0e1bb607da135">m_q</a> = q;}<a name="l00059"></a>00059 <span class="comment">// generate a random private key</span><a name="l00060"></a><a class="code" href="class_invertible_e_s_i_g_n_function.html#4ebace71d71f1e3d49bbb506105789e7">00060</a> <span class="keywordtype">void</span> <a class="code" href="class_invertible_e_s_i_g_n_function.html#43215778d1630a0037a794d815dac5d6">Initialize</a>(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &rng, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> modulusBits)<a name="l00061"></a>00061 {<a class="code" href="class_generatable_crypto_material.html#38d492343c32e530a5c2781b5797f755" title="calls the above function with a NameValuePairs object that just specifies "KeySize"...">GenerateRandomWithKeySize</a>(rng, modulusBits);}<a name="l00062"></a>00062 <a name="l00063"></a>00063 <span class="keywordtype">void</span> <a class="code" href="class_invertible_e_s_i_g_n_function.html#7e63d8fe66a25af6611f37bdaac982c4" title="decode this object from a BufferedTransformation, using BER (Basic Encoding Rules)...">BERDecode</a>(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &bt);<a name="l00064"></a>00064 <span class="keywordtype">void</span> <a class="code" href="class_invertible_e_s_i_g_n_function.html#7c12cab3cb37c52da87672ef1bc33f13" title="encode this object into a BufferedTransformation, using DER (Distinguished Encoding...">DEREncode</a>(<a class="code" href="class_buffered_transformation.html" title="interface for buffered transformations">BufferedTransformation</a> &bt) <span class="keyword">const</span>;<a name="l00065"></a>00065 <a name="l00066"></a>00066 <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> <a class="code" href="class_invertible_e_s_i_g_n_function.html#905be1ca12abad6fd3d8e862d713b7c7">CalculateRandomizedInverse</a>(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &rng, <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &x) <span class="keyword">const</span>;<a name="l00067"></a>00067 <a name="l00068"></a>00068 <span class="comment">// GeneratibleCryptoMaterial</span><a name="l00069"></a>00069 <span class="keywordtype">bool</span> <a class="code" href="class_invertible_e_s_i_g_n_function.html#1c64c8101a488232cde43a5c473742b1" 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> &rng, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> level) <span class="keyword">const</span>;<a name="l00070"></a>00070 <span class="keywordtype">bool</span> <a class="code" href="class_invertible_e_s_i_g_n_function.html#6532958ce2c456eef8b84c33f69e944d" 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 &valueType, <span class="keywordtype">void</span> *pValue) <span class="keyword">const</span>;<a name="l00071"></a>00071 <span class="keywordtype">void</span> <a class="code" href="class_invertible_e_s_i_g_n_function.html#ca870e350b30d04a47d452f21e903278" 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> &source);<span class="comment"></span><a name="l00072"></a>00072 <span class="comment"> /*! parameters: (ModulusSize) */</span><a name="l00073"></a>00073 <span class="keywordtype">void</span> <a class="code" href="class_invertible_e_s_i_g_n_function.html#241b733193f9f420f188ca6f57d49c27">GenerateRandom</a>(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &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> &alg);<a name="l00074"></a>00074 <a name="l00075"></a><a class="code" href="class_invertible_e_s_i_g_n_function.html#0fe1d3fd51750b9ae18615a22a7eb8c4">00075</a> <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>& <a class="code" href="class_invertible_e_s_i_g_n_function.html#0fe1d3fd51750b9ae18615a22a7eb8c4">GetPrime1</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="class_invertible_e_s_i_g_n_function.html#d743ae7fe10fbff6c9dddd88e76fc7fd">m_p</a>;}<a name="l00076"></a><a class="code" href="class_invertible_e_s_i_g_n_function.html#eeb9f1539c1ba2df20246db34643c5cc">00076</a> <span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a>& <a class="code" href="class_invertible_e_s_i_g_n_function.html#eeb9f1539c1ba2df20246db34643c5cc">GetPrime2</a>()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <a class="code" href="class_invertible_e_s_i_g_n_function.html#dc2b3dc52e2421e408f0e1bb607da135">m_q</a>;}<a name="l00077"></a>00077 <a name="l00078"></a><a class="code" href="class_invertible_e_s_i_g_n_function.html#fa61426f08249432a67744162aaa90a7">00078</a> <span class="keywordtype">void</span> <a class="code" href="class_invertible_e_s_i_g_n_function.html#fa61426f08249432a67744162aaa90a7">SetPrime1</a>(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &p) {<a class="code" href="class_invertible_e_s_i_g_n_function.html#d743ae7fe10fbff6c9dddd88e76fc7fd">m_p</a> = p;}<a name="l00079"></a><a class="code" href="class_invertible_e_s_i_g_n_function.html#cf24009df2af2877cf2255ac996ef983">00079</a> <span class="keywordtype">void</span> <a class="code" href="class_invertible_e_s_i_g_n_function.html#cf24009df2af2877cf2255ac996ef983">SetPrime2</a>(<span class="keyword">const</span> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> &q) {<a class="code" href="class_invertible_e_s_i_g_n_function.html#dc2b3dc52e2421e408f0e1bb607da135">m_q</a> = q;}<a name="l00080"></a>00080 <a name="l00081"></a>00081 <span class="keyword">protected</span>:<a name="l00082"></a><a class="code" href="class_invertible_e_s_i_g_n_function.html#dc2b3dc52e2421e408f0e1bb607da135">00082</a> <a class="code" href="class_integer.html" title="multiple precision integer and basic arithmetics">Integer</a> <a class="code" href="class_invertible_e_s_i_g_n_function.html#d743ae7fe10fbff6c9dddd88e76fc7fd">m_p</a>, <a class="code" href="class_invertible_e_s_i_g_n_function.html#dc2b3dc52e2421e408f0e1bb607da135">m_q</a>;<a name="l00083"></a>00083 };<a name="l00084"></a>00084 <span class="comment"></span><a name="l00085"></a>00085 <span class="comment">//! _</span><a name="l00086"></a>00086 <span class="comment"></span><span class="keyword">template</span> <<span class="keyword">class</span> T><a name="l00087"></a><a class="code" href="class_e_m_s_a5_pad.html">00087</a> <span class="keyword">class </span><a class="code" href="class_e_m_s_a5_pad.html" title="_">EMSA5Pad</a> : <span class="keyword">public</span> <a class="code" href="class_p_k___deterministic_signature_message_encoding_method.html">PK_DeterministicSignatureMessageEncodingMethod</a><a name="l00088"></a>00088 {<a name="l00089"></a>00089 <span class="keyword">public</span>:<a name="l00090"></a><a class="code" href="class_e_m_s_a5_pad.html#72d577a96e0fb8a0783f824e6fc06162">00090</a> <span class="keyword">static</span> <span class="keyword">const</span> <span class="keywordtype">char</span> *<a class="code" href="class_e_m_s_a5_pad.html#72d577a96e0fb8a0783f824e6fc06162">StaticAlgorithmName</a>() {<span class="keywordflow">return</span> <span class="stringliteral">"EMSA5"</span>;}<a name="l00091"></a>00091 <a name="l00092"></a><a class="code" href="class_e_m_s_a5_pad.html#b486fe1d6e3fc8907fa9047e4f9f091b">00092</a> <span class="keywordtype">void</span> <a class="code" href="class_e_m_s_a5_pad.html#b486fe1d6e3fc8907fa9047e4f9f091b">ComputeMessageRepresentative</a>(<a class="code" href="class_random_number_generator.html" title="interface for random number generators">RandomNumberGenerator</a> &rng, <a name="l00093"></a>00093 <span class="keyword">const</span> byte *recoverableMessage, <span class="keywordtype">size_t</span> recoverableMessageLength,<a name="l00094"></a>00094 <a class="code" href="class_hash_transformation.html" title="interface for hash functions and data processing part of MACs">HashTransformation</a> &hash, <a class="code" href="pubkey_8h.html#ef874ed3f2d212ac4629255c8ef86dd0">HashIdentifier</a> hashIdentifier, <span class="keywordtype">bool</span> messageEmpty,<a name="l00095"></a>00095 byte *representative, <span class="keywordtype">size_t</span> representativeBitLength)<span class="keyword"> const</span><a name="l00096"></a>00096 <span class="keyword"> </span>{<a name="l00097"></a>00097 <a class="code" href="class_sec_block.html" title="a block of memory allocated using A">SecByteBlock</a> digest(hash.<a class="code" href="class_hash_transformation.html#41faf8b1293a6c72390cb0c8bd668097" title="size of the hash returned by Final()">DigestSize</a>());<a name="l00098"></a>00098 hash.<a class="code" href="class_hash_transformation.html#a0b8c7a110d8968268fd02ec32b9a8e8" title="compute hash for current message, then restart for a new message">Final</a>(digest);<a name="l00099"></a>00099 <span class="keywordtype">size_t</span> representativeByteLength = BitsToBytes(representativeBitLength);<a name="l00100"></a>00100 T mgf;<a name="l00101"></a>00101 mgf.GenerateAndMask(hash, representative, representativeByteLength, digest, digest.size(), <span class="keyword">false</span>);<a name="l00102"></a>00102 <span class="keywordflow">if</span> (representativeBitLength % 8 != 0)<a name="l00103"></a>00103 representative[0] = (byte)Crop(representative[0], representativeBitLength % 8);<a name="l00104"></a>00104 }<a name="l00105"></a>00105 };<a name="l00106"></a>00106 <span class="comment"></span><a name="l00107"></a>00107 <span class="comment">//! EMSA5, for use with ESIGN</span><a name="l00108"></a><a class="code" href="struct_p1363___e_m_s_a5.html">00108</a> <span class="comment"></span><span class="keyword">struct </span><a class="code" href="struct_p1363___e_m_s_a5.html" title="EMSA5, for use with ESIGN.">P1363_EMSA5</a> : <span class="keyword">public</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="l00109"></a>00109 {<a name="l00110"></a><a class="code" href="struct_p1363___e_m_s_a5.html#e3497af6c7b2c4c3c586ab43c3e9d704">00110</a> <span class="keyword">typedef</span> <a class="code" href="class_e_m_s_a5_pad.html" title="_">EMSA5Pad<P1363_MGF1></a> <a class="code" href="class_e_m_s_a5_pad.html" title="_">SignatureMessageEncodingMethod</a>;<a name="l00111"></a>00111 };<a name="l00112"></a>00112 <a name="l00113"></a><a class="code" href="struct_e_s_i_g_n___keys.html">00113</a> <span class="keyword">struct </span><a class="code" href="struct_e_s_i_g_n___keys.html">ESIGN_Keys</a><a name="l00114"></a>00114 {<a name="l00115"></a><a class="code" href="struct_e_s_i_g_n___keys.html#902d9a2b1a042100ba0d461ef23be0fd">00115</a> <span class="keyword">static</span> std::string <a class="code" href="struct_e_s_i_g_n___keys.html#902d9a2b1a042100ba0d461ef23be0fd">StaticAlgorithmName</a>() {<span class="keywordflow">return</span> <span class="stringliteral">"ESIGN"</span>;}<a name="l00116"></a><a class="code" href="struct_e_s_i_g_n___keys.html#483df06da0d1268d682596fcfc96c848">00116</a> <span class="keyword">typedef</span> <a class="code" href="class_e_s_i_g_n_function.html" title="_">ESIGNFunction</a> <a class="code" href="class_e_s_i_g_n_function.html" title="_">PublicKey</a>;<a name="l00117"></a><a class="code" href="struct_e_s_i_g_n___keys.html#79168232602a9112e28e72fc128e2ec8">00117</a> <span class="keyword">typedef</span> <a class="code" href="class_invertible_e_s_i_g_n_function.html" title="_">InvertibleESIGNFunction</a> <a class="code" href="class_invertible_e_s_i_g_n_function.html" title="_">PrivateKey</a>;<a name="l00118"></a>00118 };<a name="l00119"></a>00119 <span class="comment"></span><a name="l00120"></a>00120 <span class="comment">//! ESIGN, as defined in IEEE P1363a</span><a name="l00121"></a>00121 <span class="comment"></span><span class="keyword">template</span> <<span class="keyword">class</span> H, <span class="keyword">class</span> STANDARD = P1363_EMSA5><a name="l00122"></a><a class="code" href="struct_e_s_i_g_n.html">00122</a> <span class="keyword">struct </span><a class="code" href="struct_e_s_i_g_n.html" title="ESIGN, as defined in IEEE P1363a.">ESIGN</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><STANDARD, H, ESIGN_Keys><a name="l00123"></a>00123 {<a name="l00124"></a>00124 };<a name="l00125"></a>00125 <a name="l00126"></a>00126 NAMESPACE_END<a name="l00127"></a>00127 <a name="l00128"></a>00128 <span class="preprocessor">#endif</span></pre></div><hr size="1"><address style="text-align: right;"><small>Generated on Fri Jun 1 11:11:21 2007 for Crypto++ by <a href="http://www.doxygen.org/index.html"><img src="doxygen.png" alt="doxygen" align="middle" border="0"></a> 1.5.2 </small></address></body></html>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -