⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 pubkey_8h-source.html

📁 Crypto++是一个非常强大的密码学库,主要是功能全
💻 HTML
📖 第 1 页 / 共 5 页
字号:
00345 <span class="comment"></span>00346 <span class="comment">//! .</span>00347 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> SCHEME_OPTIONS&gt;<a name="l00348"></a><a class="code" href="class_t_f___digest_signer_impl.html">00348</a> <span class="keyword">class </span><a class="code" href="class_t_f___digest_signer_impl.html">TF_DigestSignerImpl</a> : <span class="keyword">public</span> <a class="code" href="class_t_f___private_object_impl.html">TF_PrivateObjectImpl</a>&lt;TF_DigestSignerBase, SCHEME_OPTIONS&gt;00349 {00350 };00351 <span class="comment"></span>00352 <span class="comment">//! .</span>00353 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> SCHEME_OPTIONS&gt;<a name="l00354"></a><a class="code" href="class_t_f___digest_verifier_impl.html">00354</a> <span class="keyword">class </span><a class="code" href="class_t_f___digest_verifier_impl.html">TF_DigestVerifierImpl</a> : <span class="keyword">public</span> <a class="code" href="class_t_f___public_object_impl.html">TF_PublicObjectImpl</a>&lt;TF_DigestVerifierBase, SCHEME_OPTIONS&gt;00355 {00356 };00357 00358 <span class="comment">// ********************************************************</span>00359 <span class="comment"></span>00360 <span class="comment">//! .</span>00361 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> H&gt;<a name="l00362"></a><a class="code" href="class_p1363___m_g_f1.html">00362</a> <span class="keyword">class </span><a class="code" href="class_p1363___m_g_f1.html">P1363_MGF1</a>00363 {00364 <span class="keyword">public</span>:00365         <span class="keyword">static</span> std::string StaticAlgorithmName() {<span class="keywordflow">return</span> std::string(<span class="stringliteral">"MGF1("</span>) + H::StaticAlgorithmName() + <span class="stringliteral">")"</span>;}00366         <span class="keyword">static</span> <span class="keywordtype">void</span> GenerateAndMask(byte *output, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> outputLength, <span class="keyword">const</span> byte *input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> inputLength);00367 };00368 00369 <span class="keyword">template</span> &lt;<span class="keyword">class</span> H&gt;00370 <span class="keywordtype">void</span> <a class="code" href="class_p1363___m_g_f1.html">P1363_MGF1&lt;H&gt;::GenerateAndMask</a>(byte *output, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> outputLength, <span class="keyword">const</span> byte *input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> inputLength)00371 {00372         H h;00373         <a class="code" href="class_array_xor_sink.html">ArrayXorSink</a> *sink;00374         <a class="code" href="class_hash_filter.html">HashFilter</a> filter(h, sink = <span class="keyword">new</span> <a class="code" href="class_array_xor_sink.html">ArrayXorSink</a>(output, outputLength));00375         word32 counter = 0;00376         <span class="keywordflow">while</span> (sink-&gt;<a class="code" href="class_array_sink.html#_array_xor_sinka3">AvailableSize</a>() &gt; 0)00377         {00378                 filter.<a class="code" href="class_buffered_transformation.html#_zlib_decompressorz1_0">Put</a>(input, inputLength);00379                 filter.<a class="code" href="class_buffered_transformation.html#_zlib_decompressorz1_3">PutWord32</a>(counter++);00380                 filter.<a class="code" href="class_buffered_transformation.html#_zlib_decompressorz1_7">MessageEnd</a>();00381         }00382 }00383 00384 <span class="comment">// ********************************************************</span>00385 <span class="comment"></span>00386 <span class="comment">//! .</span>00387 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> H&gt;<a name="l00388"></a><a class="code" href="class_p1363___k_d_f2.html">00388</a> <span class="keyword">class </span><a class="code" href="class_p1363___k_d_f2.html">P1363_KDF2</a>00389 {00390 <span class="keyword">public</span>:00391         <span class="keyword">static</span> <span class="keywordtype">void</span> DeriveKey(byte *output, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> outputLength, <span class="keyword">const</span> byte *input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> inputLength);00392 };00393 00394 <span class="keyword">template</span> &lt;<span class="keyword">class</span> H&gt;00395 <span class="keywordtype">void</span> <a class="code" href="class_p1363___k_d_f2.html">P1363_KDF2&lt;H&gt;::DeriveKey</a>(byte *output, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> outputLength, <span class="keyword">const</span> byte *input, <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> inputLength)00396 {00397         H h;00398         <a class="code" href="class_array_sink.html">ArraySink</a> *sink;00399         <a class="code" href="class_hash_filter.html">HashFilter</a> filter(h, sink = <span class="keyword">new</span> <a class="code" href="class_array_sink.html">ArraySink</a>(output, outputLength));00400         word32 counter = 1;00401         <span class="keywordflow">while</span> (sink-&gt;<a class="code" href="class_array_sink.html#_array_xor_sinka3">AvailableSize</a>() &gt; 0)00402         {00403                 filter.<a class="code" href="class_buffered_transformation.html#_zlib_decompressorz1_0">Put</a>(input, inputLength);00404                 filter.<a class="code" href="class_buffered_transformation.html#_zlib_decompressorz1_3">PutWord32</a>(counter++);00405                 filter.<a class="code" href="class_buffered_transformation.html#_zlib_decompressorz1_7">MessageEnd</a>();00406         }00407 }00408 00409 <span class="comment">// ********************************************************</span>00410 <span class="comment"></span>00411 <span class="comment">//! .</span>00412 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> H, <span class="keyword">class</span> INTERFACE, <span class="keyword">class</span> DS_INTERFACE&gt;<a name="l00413"></a><a class="code" href="class_p_k___signature_scheme_base.html">00413</a> <span class="keyword">class </span><a class="code" href="class_p_k___signature_scheme_base.html">PK_SignatureSchemeBase</a> : <span class="keyword">public</span> INTERFACE00414 {00415 <span class="keyword">public</span>:00416         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> SignatureLength()<span class="keyword"> const </span>{<span class="keywordflow">return</span> GetDigestSignatureSchemeInterface().DigestSignatureLength();}00417         <a class="code" href="class_hash_transformation.html">HashTransformation</a> * NewMessageAccumulator()<span class="keyword"> const </span>{<span class="keywordflow">return</span> <span class="keyword">new</span> H;}00418 00419         <span class="keyword">virtual</span> <span class="keyword">const</span> DS_INTERFACE &amp; GetDigestSignatureSchemeInterface() <span class="keyword">const</span> =0;00420 };00421 <span class="comment"></span>00422 <span class="comment">//! .</span>00423 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> H&gt;<a name="l00424"></a><a class="code" href="class_p_k___signer_base.html">00424</a> <span class="keyword">class </span><a class="code" href="class_p_k___signer_base.html">PK_SignerBase</a> : <span class="keyword">public</span> <a class="code" href="class_p_k___signature_scheme_base.html">PK_SignatureSchemeBase</a>&lt;H, PK_Signer, DigestSigner&gt;00425 {00426 <span class="keyword">public</span>:00427         <span class="keywordtype">void</span> <a class="code" href="class_p_k___signer_base.html#_p_k___signer_impla12">SignAndRestart</a>(<a class="code" href="class_random_number_generator.html">RandomNumberGenerator</a> &amp;rng, <a class="code" href="class_hash_transformation.html">HashTransformation</a> &amp;messageAccumulator, byte *signature) <span class="keyword">const</span>;00428 };00429 <span class="comment"></span>00430 <span class="comment">//! .</span>00431 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> H&gt;<a name="l00432"></a><a class="code" href="class_p_k___verifier_base.html">00432</a> <span class="keyword">class </span><a class="code" href="class_p_k___verifier_base.html">PK_VerifierBase</a> : <span class="keyword">public</span> <a class="code" href="class_p_k___signature_scheme_base.html">PK_SignatureSchemeBase</a>&lt;H, PK_Verifier, DigestVerifier&gt;00433 {00434 <span class="keyword">public</span>:00435         <span class="keywordtype">bool</span> <a class="code" href="class_p_k___verifier_base.html#_p_k___verifier_impla11">VerifyAndRestart</a>(<a class="code" href="class_hash_transformation.html">HashTransformation</a> &amp;messageAccumulator, <span class="keyword">const</span> byte *sig) <span class="keyword">const</span>;00436 };00437 00438 <span class="keyword">template</span> &lt;<span class="keyword">class</span> H&gt;<a name="l00439"></a><a class="code" href="class_p_k___signer_base.html#_p_k___signer_impla12">00439</a> <span class="keywordtype">void</span> <a class="code" href="class_p_k___signer_base.html#_p_k___signer_impla12">PK_SignerBase&lt;H&gt;::SignAndRestart</a>(<a class="code" href="class_random_number_generator.html">RandomNumberGenerator</a> &amp;rng, <a class="code" href="class_hash_transformation.html">HashTransformation</a> &amp;messageAccumulator, byte *signature)<span class="keyword"> const</span>00440 <span class="keyword"></span>{00441         <span class="keywordflow">if</span> (messageAccumulator.<a class="code" href="class_hash_transformation.html#_x_m_a_c_ca9">DigestSize</a>() &gt; GetDigestSignatureSchemeInterface().<a class="code" href="class_digest_signature_system.html#_digest_verifiera1">MaxDigestLength</a>())00442                 <span class="keywordflow">throw</span> <a class="code" href="class_p_k___signer_1_1_key_too_short.html">PK_Signer::KeyTooShort</a>();00443         <a class="code" href="class_sec_block.html">SecByteBlock</a> digest(messageAccumulator.<a class="code" href="class_hash_transformation.html#_x_m_a_c_ca9">DigestSize</a>());00444         messageAccumulator.<a class="code" href="class_hash_transformation.html#_x_m_a_c_c___basea13">Final</a>(digest);00445         GetDigestSignatureSchemeInterface().<a class="code" href="class_digest_signer.html#_t_f___digest_signature_system_base_3_01_digest_signer_00_01_t_f___base_3_01_randomized_trapdoor_function_inverse_01_4_01_4a2">SignDigest</a>(rng, digest, digest.<a class="code" href="class_sec_block.html#_sec_block_with_hinta13">size</a>(), signature);00446 }00447 00448 <span class="keyword">template</span> &lt;<span class="keyword">class</span> H&gt;<a name="l00449"></a><a class="code" href="class_p_k___verifier_base.html#_p_k___verifier_impla11">00449</a> <span class="keywordtype">bool</span> <a class="code" href="class_p_k___verifier_base.html#_p_k___verifier_impla11">PK_VerifierBase&lt;H&gt;::VerifyAndRestart</a>(<a class="code" href="class_hash_transformation.html">HashTransformation</a> &amp;messageAccumulator, <span class="keyword">const</span> byte *sig)<span class="keyword"> const</span>00450 <span class="keyword"></span>{00451         <a class="code" href="class_sec_block.html">SecByteBlock</a> digest(messageAccumulator.<a class="code" href="class_hash_transformation.html#_x_m_a_c_ca9">DigestSize</a>());00452         messageAccumulator.<a class="code" href="class_hash_transformation.html#_x_m_a_c_c___basea13">Final</a>(digest);00453         <span class="keywordflow">return</span> GetDigestSignatureSchemeInterface().<a class="code" href="class_digest_verifier.html#_t_f___digest_signature_system_base_3_01_digest_verifier_00_01_t_f___base_3_01_trapdoor_function_01_4_01_4a2">VerifyDigest</a>(digest, digest.<a class="code" href="class_sec_block.html#_sec_block_with_hinta13">size</a>(), sig);00454 }00455 <span class="comment"></span>00456 <span class="comment">//! .</span>00457 <span class="comment"></span><span class="keyword">template</span> &lt;<span class="keyword">class</span> BASE, <span class="keyword">class</span> DS&gt;<a name="l00458"></a><a class="code" href="class_p_k___signature_scheme_impl.html">00458</a> <span class="keyword">class </span><a class="code" href="class_p_k___signature_scheme_impl.html">PK_SignatureSchemeImpl</a> : <span class="keyword">public</span> BASE00459 {00460 <span class="keyword">public</span>:00461         <span class="keyword">typedef</span> <span class="keyword">typename</span> DS::KeyClass KeyClass;

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -