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

📄 pubkey_8h-source.html

📁 著名的密码库Crypto++的文档 C++语言的杰作。程序员必备。
💻 HTML
📖 第 1 页 / 共 5 页
字号:
<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 TF_CryptoSystemBase : <span class="keyword">public</span> PK_FixedLengthCryptoSystemImpl&lt;INTERFACE&gt;, <span class="keyword">protected</span> BASE<a name="l00154"></a>00154 {<a name="l00155"></a>00155 <span class="keyword">public</span>:<a name="l00156"></a><a class="code" href="class_t_f___crypto_system_base.html#7e3d9b64229a0eeb41208425898c3be4">00156</a>         <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><a class="code" href="class_t_f___crypto_system_base.html#28e8c81f06982065c479b0eb561f3e86">00157</a>         <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><a class="code" href="class_t_f___crypto_system_base.html#91638e029e369d985f7858ad7daf2019">00158</a>         <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><a class="code" href="class_t_f___crypto_system_base.html#5ad757b5d844b247b0f40969ab5d5957">00161</a>         <span class="keywordtype">size_t</span> PaddedBlockByteLength()<span class="keyword"> const </span>{<span class="keywordflow">return</span> BitsToBytes(PaddedBlockBitLength());}<a name="l00162"></a><a class="code" href="class_t_f___crypto_system_base.html#bb04a40679e4c4ec5a0eb00b85615d56">00162</a>         <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 TF_DecryptorBase : <span class="keyword">public</span> TF_CryptoSystemBase&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 TF_EncryptorBase : <span class="keyword">public</span> TF_CryptoSystemBase&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><a class="code" href="pubkey_8h.html#ef874ed3f2d212ac4629255c8ef86dd0">00181</a> <span class="keyword">typedef</span> std::pair&lt;const byte *, size_t&gt; <a class="code" href="pubkey_8h.html#ef874ed3f2d212ac4629255c8ef86dd0">HashIdentifier</a>;<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 PK_SignatureMessageEncodingMethod<a name="l00185"></a>00185 {<a name="l00186"></a>00186 <span class="keyword">public</span>:<a name="l00187"></a><a class="code" href="class_p_k___signature_message_encoding_method.html#12cd23d84589354621ceaba2c1d0428b">00187</a>         <span class="keyword">virtual</span> ~PK_SignatureMessageEncodingMethod() {}<a name="l00188"></a>00188 <a name="l00189"></a><a class="code" href="class_p_k___signature_message_encoding_method.html#0fa26f3c87be18c7be3d851537c276d6">00189</a>         <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><a class="code" href="class_p_k___signature_message_encoding_method.html#d93488f6af02bd529106c78f6e177a29">00191</a>         <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><a class="code" href="class_p_k___signature_message_encoding_method.html#941810045fcb8d0db4b98f99c5f3ae94">00194</a>         <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><a class="code" href="class_p_k___signature_message_encoding_method.html#a0212d888226eaddeff0ca34f6a09a82">00196</a>         <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">"PK_MessageEncodingMethod: this signature scheme does not support message recovery"</span>);}<a name="l00198"></a><a class="code" href="class_p_k___signature_message_encoding_method.html#00026ee661b85b868de74ff9652788a8">00198</a>         <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">"PK_MessageEncodingMethod: this signature scheme does not support message recovery"</span>);}<a name="l00200"></a>00200 <a name="l00201"></a>00201         <span class="comment">// for verification, DL</span><a name="l00202"></a><a class="code" href="class_p_k___signature_message_encoding_method.html#1a029db5f50a57442604b6581b49e2af">00202</a>         <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><a class="code" href="class_p_k___signature_message_encoding_method.html#02cb23717289879c7e0fc7a0af804be7">00205</a>         <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" title="a block of memory allocated using A">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">"ProcessRecoverableMessage() not implemented"</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, <a class="code" href="pubkey_8h.html#ef874ed3f2d212ac4629255c8ef86dd0">HashIdentifier</a> 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, <a class="code" href="pubkey_8h.html#ef874ed3f2d212ac4629255c8ef86dd0">HashIdentifier</a> 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><a class="code" href="class_p_k___signature_message_encoding_method.html#4debaa9f683a82bb11fbeb668bacbd04">00223</a>         <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, <a class="code" href="pubkey_8h.html#ef874ed3f2d212ac4629255c8ef86dd0">HashIdentifier</a> 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">"PK_MessageEncodingMethod: this signature scheme does not support message recovery"</span>);}<a name="l00228"></a>00228 <a name="l00229"></a><a class="code" href="class_p_k___signature_message_encoding_method.html#eb4341de01651a70f62344609c0f1dd8">00229</a>         <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, <a class="code" href="pubkey_8h.html#ef874ed3f2d212ac4629255c8ef86dd0">HashIdentifier</a> 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">"PK_MessageEncodingMethod: this signature scheme does not support message recovery"</span>);}

⌨️ 快捷键说明

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