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

📄 cryptlib_8h-source.html

📁 Crypto++是一个非常强大的密码学库,主要是功能全
💻 HTML
📖 第 1 页 / 共 5 页
字号:
00108 <span class="comment">        //! error types</span><a name="l00109"></a><a class="code" href="class_exception.html#_zlib_decompressor_1_1_unsupported_preset_dictionaryw7">00109</a> <span class="comment"></span>        <span class="keyword">enum</span> ErrorType {<span class="comment"></span>00110 <span class="comment">                //! a method is not implemented</span>00111 <span class="comment"></span>                NOT_IMPLEMENTED,<span class="comment"></span>00112 <span class="comment">                //! invalid function argument</span>00113 <span class="comment"></span>                INVALID_ARGUMENT,<span class="comment"></span>00114 <span class="comment">                //! BufferedTransformation received a Flush(true) signal but can't flush buffers</span>00115 <span class="comment"></span>                CANNOT_FLUSH,<span class="comment"></span>00116 <span class="comment">                //! data integerity check (such as CRC or MAC) failed</span>00117 <span class="comment"></span>                DATA_INTEGRITY_CHECK_FAILED,<span class="comment"></span>00118 <span class="comment">                //! received input data that doesn't conform to expected format</span>00119 <span class="comment"></span>                INVALID_DATA_FORMAT,<span class="comment"></span>00120 <span class="comment">                //! error reading from input device or writing to output device</span>00121 <span class="comment"></span>                IO_ERROR,<span class="comment"></span>00122 <span class="comment">                //! some error not belong to any of the above categories</span>00123 <span class="comment"></span>                OTHER_ERROR00124         };00125 00126         <span class="keyword">explicit</span> Exception(ErrorType errorType, <span class="keyword">const</span> std::string &amp;s) : m_what(s) {}00127         <span class="keyword">virtual</span> ~Exception() <span class="keywordflow">throw</span>() {}00128         <span class="keyword">const</span> <span class="keywordtype">char</span> *what() <span class="keyword">const</span> <span class="keywordflow">throw</span>() {<span class="keywordflow">return</span> (m_what.c_str());}00129         <span class="keyword">const</span> std::string &amp;GetWhat()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_what;}00130         <span class="keywordtype">void</span> SetWhat(<span class="keyword">const</span> std::string &amp;s) {m_what = s;}00131         ErrorType GetErrorType()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_errorType;}00132         <span class="keywordtype">void</span> SetErrorType(ErrorType errorType) {m_errorType = errorType;}00133 00134 <span class="keyword">private</span>:00135         ErrorType m_errorType;00136         std::string m_what;00137 };00138 <span class="comment"></span>00139 <span class="comment">//! exception thrown when an invalid argument is detected</span><a name="l00140"></a><a class="code" href="class_invalid_argument.html">00140</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_DLL InvalidArgument : <span class="keyword">public</span> Exception00141 {00142 <span class="keyword">public</span>:00143         <span class="keyword">explicit</span> InvalidArgument(<span class="keyword">const</span> std::string &amp;s) : Exception(INVALID_ARGUMENT, s) {}00144 };00145 <span class="comment"></span>00146 <span class="comment">//! exception thrown by decryption filters when trying to decrypt an invalid ciphertext</span><a name="l00147"></a><a class="code" href="class_invalid_data_format.html">00147</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_DLL InvalidDataFormat : <span class="keyword">public</span> Exception00148 {00149 <span class="keyword">public</span>:00150         <span class="keyword">explicit</span> InvalidDataFormat(<span class="keyword">const</span> std::string &amp;s) : Exception(INVALID_DATA_FORMAT, s) {}00151 };00152 <span class="comment"></span>00153 <span class="comment">//! exception thrown by decryption filters when trying to decrypt an invalid ciphertext</span><a name="l00154"></a><a class="code" href="class_invalid_ciphertext.html">00154</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_DLL InvalidCiphertext : <span class="keyword">public</span> InvalidDataFormat00155 {00156 <span class="keyword">public</span>:00157         <span class="keyword">explicit</span> InvalidCiphertext(<span class="keyword">const</span> std::string &amp;s) : InvalidDataFormat(s) {}00158 };00159 <span class="comment"></span>00160 <span class="comment">//! exception thrown by a class if a non-implemented method is called</span><a name="l00161"></a><a class="code" href="class_not_implemented.html">00161</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_DLL NotImplemented : <span class="keyword">public</span> Exception00162 {00163 <span class="keyword">public</span>:00164         <span class="keyword">explicit</span> NotImplemented(<span class="keyword">const</span> std::string &amp;s) : Exception(NOT_IMPLEMENTED, s) {}00165 };00166 <span class="comment"></span>00167 <span class="comment">//! exception thrown by a class when Flush(true) is called but it can't completely flush its buffers</span><a name="l00168"></a><a class="code" href="class_cannot_flush.html">00168</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_DLL CannotFlush : <span class="keyword">public</span> Exception00169 {00170 <span class="keyword">public</span>:00171         <span class="keyword">explicit</span> CannotFlush(<span class="keyword">const</span> std::string &amp;s) : Exception(CANNOT_FLUSH, s) {}00172 };00173 <span class="comment"></span>00174 <span class="comment">//! error reported by the operating system</span><a name="l00175"></a><a class="code" href="class_o_s___error.html">00175</a> <span class="comment"></span><span class="keyword">class </span>CRYPTOPP_DLL OS_Error : <span class="keyword">public</span> Exception00176 {00177 <span class="keyword">public</span>:00178         OS_Error(ErrorType errorType, <span class="keyword">const</span> std::string s, <span class="keyword">const</span> std::string&amp; operation, <span class="keywordtype">int</span> errorCode)00179                 : Exception(errorType, s), m_operation(operation), m_errorCode(errorCode) {}00180         ~OS_Error() <span class="keywordflow">throw</span>() {}00181 00182         <span class="comment">// the operating system API that reported the error</span>00183         <span class="keyword">const</span> std::string &amp; GetOperation()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_operation;}00184         <span class="comment">// the error code return by the operating system</span>00185         <span class="keywordtype">int</span> GetErrorCode()<span class="keyword"> const </span>{<span class="keywordflow">return</span> m_errorCode;}00186 00187 <span class="keyword">protected</span>:00188         std::string m_operation;00189         <span class="keywordtype">int</span> m_errorCode;00190 };00191 <span class="comment"></span>00192 <span class="comment">//! used to return decoding results</span><a name="l00193"></a><a class="code" href="struct_decoding_result.html">00193</a> <span class="comment"></span><span class="keyword">struct </span>CRYPTOPP_DLL DecodingResult00194 {00195         <span class="keyword">explicit</span> DecodingResult() : isValidCoding(<span class="keyword">false</span>), messageLength(0) {}00196         <span class="keyword">explicit</span> DecodingResult(<span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> len) : isValidCoding(<span class="keyword">true</span>), messageLength(len) {}00197 00198         <span class="keywordtype">bool</span> operator==(<span class="keyword">const</span> DecodingResult &amp;rhs)<span class="keyword"> const </span>{<span class="keywordflow">return</span> isValidCoding == rhs.<a class="code" href="struct_decoding_result.html#_decoding_resulto0">isValidCoding</a> &amp;&amp; messageLength == rhs.<a class="code" href="struct_decoding_result.html#_decoding_resulto1">messageLength</a>;}00199         <span class="keywordtype">bool</span> operator!=(<span class="keyword">const</span> DecodingResult &amp;rhs)<span class="keyword"> const </span>{<span class="keywordflow">return</span> !operator==(rhs);}00200 00201         <span class="keywordtype">bool</span> isValidCoding;00202         <span class="keywordtype">unsigned</span> <span class="keywordtype">int</span> messageLength;00203 00204 <span class="preprocessor">#ifdef CRYPTOPP_MAINTAIN_BACKWARDS_COMPATIBILITY</span>00205 <span class="preprocessor"></span>        operator unsigned int()<span class="keyword"> const </span>{<span class="keywordflow">return</span> isValidCoding ? messageLength : 0;}00206 <span class="preprocessor">#endif</span>00207 <span class="preprocessor"></span>};00208 <span class="comment"></span>00209 <span class="comment">//! interface for retrieving values given their names</span>00210 <span class="comment"></span><span class="comment">/*! This class is used to safely pass a variable number of arbitrarily typed arguments to functions</span>00211 <span class="comment">        and to read values from keys and crypto parameters.</span>00212 <span class="comment">        To get a value, you need to know the name and the type of the value. </span>00213 <span class="comment">        Call GetValueNames() on a NameValuePairs object to obtain a list of value names that it supports.</span>00214 <span class="comment">        Then look at the Name namespace documentation to see what the type of each value is, or</span>00215 <span class="comment">        alternatively, call GetIntValue() with the value name, and if the type is not int, a</span>00216 <span class="comment">        ValueTypeMismatch exception will be thrown and you can get the actual type from the exception object.</span>00217 <span class="comment">*/</span><a name="l00218"></a><a class="code" href="class_name_value_pairs.html">00218</a> <span class="keyword">class </span><a class="code" href="class_name_value_pairs.html">NameValuePairs</a>00219 {00220 <span class="keyword">public</span>:00221         <span class="keyword">virtual</span> ~<a class="code" href="class_name_value_pairs.html">NameValuePairs</a>() {}

⌨️ 快捷键说明

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