📄 cypher_8h-source.html
字号:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN"><html><head><meta http-equiv="Content-Type" content="text/html;charset=iso-8859-1"><title>cypher.h Source File</title><link href="doxygen.css" rel="stylesheet" type="text/css"></head><body><!-- Generated by Doxygen 1.2.18 --><center><a class="qindex" href="index.html">Main Page</a> <a class="qindex" href="namespaces.html">Namespace List</a> <a class="qindex" href="hierarchy.html">Class Hierarchy</a> <a class="qindex" href="annotated.html">Compound List</a> <a class="qindex" href="files.html">File List</a> <a class="qindex" href="functions.html">Compound Members</a> <a class="qindex" href="globals.html">File Members</a> </center><hr><h1>cypher.h</h1><a href="cypher_8h.html">Go to the documentation of this file.</a><div class="fragment"><pre>00001 <span class="comment">/*</span>00002 <span class="comment"> * cypher.h</span>00003 <span class="comment"> *</span>00004 <span class="comment"> * Encryption support classes.</span>00005 <span class="comment"> *</span>00006 <span class="comment"> * Portable Windows Library</span>00007 <span class="comment"> *</span>00008 <span class="comment"> * Copyright (c) 1993-2002 Equivalence Pty. Ltd.</span>00009 <span class="comment"> *</span>00010 <span class="comment"> * The contents of this file are subject to the Mozilla Public License</span>00011 <span class="comment"> * Version 1.0 (the "License"); you may not use this file except in</span>00012 <span class="comment"> * compliance with the License. You may obtain a copy of the License at</span>00013 <span class="comment"> * http://www.mozilla.org/MPL/</span>00014 <span class="comment"> *</span>00015 <span class="comment"> * Software distributed under the License is distributed on an "AS IS"</span>00016 <span class="comment"> * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See</span>00017 <span class="comment"> * the License for the specific language governing rights and limitations</span>00018 <span class="comment"> * under the License.</span>00019 <span class="comment"> *</span>00020 <span class="comment"> * The Original Code is Portable Windows Library.</span>00021 <span class="comment"> *</span>00022 <span class="comment"> * The Initial Developer of the Original Code is Equivalence Pty. Ltd.</span>00023 <span class="comment"> *</span>00024 <span class="comment"> * Contributor(s): ______________________________________.</span>00025 <span class="comment"> *</span>00026 <span class="comment"> * $Log: cypher.h,v $</span>00027 <span class="comment"> * Revision 1.20 2004/03/23 05:59:17 csoutheren</span>00028 <span class="comment"> * Moved the Base64 routines into cypher.cxx, which is a more sensible</span>00029 <span class="comment"> * place and reduces the inclusion of unrelated code</span>00030 <span class="comment"> *</span>00031 <span class="comment"> * Revision 1.19 2004/02/04 02:31:34 csoutheren</span>00032 <span class="comment"> * Remove SHA-1 functions when OpenSSL is disabled</span>00033 <span class="comment"> *</span>00034 <span class="comment"> * Revision 1.18 2003/04/17 03:34:07 craigs</span>00035 <span class="comment"> * Fixed problem with delete'ing a void *</span>00036 <span class="comment"> *</span>00037 <span class="comment"> * Revision 1.17 2003/04/10 07:02:38 craigs</span>00038 <span class="comment"> * Fixed link problem in MD5 class</span>00039 <span class="comment"> *</span>00040 <span class="comment"> * Revision 1.16 2003/04/10 06:16:30 craigs</span>00041 <span class="comment"> * Added SHA-1 digest</span>00042 <span class="comment"> *</span>00043 <span class="comment"> * Revision 1.15 2002/11/06 22:47:23 robertj</span>00044 <span class="comment"> * Fixed header comment (copyright etc)</span>00045 <span class="comment"> *</span>00046 <span class="comment"> * Revision 1.14 2002/09/16 01:08:59 robertj</span>00047 <span class="comment"> * Added #define so can select if #pragma interface/implementation is used on</span>00048 <span class="comment"> * platform basis (eg MacOS) rather than compiler, thanks Robert Monaghan.</span>00049 <span class="comment"> *</span>00050 <span class="comment"> * Revision 1.13 2001/09/10 00:28:21 robertj</span>00051 <span class="comment"> * Fixed extra CR in comments.</span>00052 <span class="comment"> *</span>00053 <span class="comment"> * Revision 1.12 1999/03/09 08:01:46 robertj</span>00054 <span class="comment"> * Changed comments for doc++ support (more to come).</span>00055 <span class="comment"> *</span>00056 <span class="comment"> * Revision 1.11 1999/02/16 08:07:10 robertj</span>00057 <span class="comment"> * MSVC 6.0 compatibility changes.</span>00058 <span class="comment"> *</span>00059 <span class="comment"> * Revision 1.10 1998/09/23 06:19:24 robertj</span>00060 <span class="comment"> * Added open source copyright license.</span>00061 <span class="comment"> *</span>00062 <span class="comment"> * Revision 1.9 1997/10/10 10:44:01 robertj</span>00063 <span class="comment"> * Fixed bug in password encryption, missing string terminator.</span>00064 <span class="comment"> *</span>00065 <span class="comment"> * Revision 1.8 1996/11/16 10:50:24 robertj</span>00066 <span class="comment"> * Fixed bug in registration order form showing incorrect check code when have key.</span>00067 <span class="comment"> *</span>00068 <span class="comment"> * Revision 1.7 1996/07/15 10:29:38 robertj</span>00069 <span class="comment"> * Changed memory block cypher conversion functions to be void *.</span>00070 <span class="comment"> * Changed key types to be structures rather than arrays to avoid pinter/reference confusion by compilers.</span>00071 <span class="comment"> *</span>00072 <span class="comment"> * Revision 1.6 1996/03/17 05:47:00 robertj</span>00073 <span class="comment"> * Changed secured config to allow for expiry dates.</span>00074 <span class="comment"> *</span>00075 <span class="comment"> * Revision 1.5 1996/03/16 04:36:43 robertj</span>00076 <span class="comment"> * Redesign of secure config to accommodate expiry dates and option values passed in security key code.</span>00077 <span class="comment"> *</span>00078 <span class="comment"> * Revision 1.4 1996/02/25 02:52:46 robertj</span>00079 <span class="comment"> * Further secure config development.</span>00080 <span class="comment"> *</span>00081 <span class="comment"> * Revision 1.3 1996/01/28 14:16:11 robertj</span>00082 <span class="comment"> * Further implementation of secure config.</span>00083 <span class="comment"> *</span>00084 <span class="comment"> * Revision 1.2 1996/01/28 02:41:00 robertj</span>00085 <span class="comment"> * Removal of MemoryPointer classes as usage didn't work for GNU.</span>00086 <span class="comment"> * Added the secure configuration mechanism for protecting applications.</span>00087 <span class="comment"> *</span>00088 <span class="comment"> * Revision 1.1 1996/01/23 13:04:20 robertj</span>00089 <span class="comment"> * Initial revision</span>00090 <span class="comment"> *</span>00091 <span class="comment"> */</span>00092 00093 00094 <span class="preprocessor">#ifndef _PCYPHER</span>00095 <span class="preprocessor"></span><span class="preprocessor">#define _PCYPHER</span>00096 <span class="preprocessor"></span>00097 <span class="preprocessor">#ifdef P_USE_PRAGMA</span>00098 <span class="preprocessor"></span><span class="preprocessor">#pragma interface</span>00099 <span class="preprocessor"></span><span class="preprocessor">#endif</span>00100 <span class="preprocessor"></span><a name="l00131"></a><a class="code" href="classPBase64.html">00131</a> <span class="keyword">class </span><a class="code" href="classPBase64.html">PBase64</a> : <span class="keyword">public</span> <a class="code" href="classPObject.html">PObject</a>00132 {00133 <a class="code" href="object_8h.html#a27">PCLASSINFO</a>(<a class="code" href="classPBase64.html">PBase64</a>, <a class="code" href="classPObject.html">PObject</a>);00134 00135 <span class="keyword">public</span>:00139 <a class="code" href="classPBase64.html#a0">PBase64</a>();00140 00141 <span class="keywordtype">void</span> <a class="code" href="classPBase64.html#a1">StartEncoding</a>(00142 BOOL useCRLFs = TRUE <span class="comment">// Use CR, LF pairs in end of line characters.</span>00143 );00144 <span class="comment">// Begin a base 64 encoding operation, initialising the object instance.</span>00145 00146 <span class="keywordtype">void</span> <a class="code" href="classPBase64.html#a2">ProcessEncoding</a>(00147 <span class="keyword">const</span> <a class="code" href="classPString.html">PString</a> & str <span class="comment">// String to be encoded</span>00148 );00149 <span class="keywordtype">void</span> <a class="code" href="classPBase64.html#a2">ProcessEncoding</a>(00150 <span class="keyword">const</span> <span class="keywordtype">char</span> * cstr <span class="comment">// C String to be encoded</span>00151 );00152 <span class="keywordtype">void</span> <a class="code" href="classPBase64.html#a2">ProcessEncoding</a>(00153 <span class="keyword">const</span> <a class="code" href="classPBYTEArray.html">PBYTEArray</a> & data <span class="comment">// Data block to be encoded</span>00154 );00155 <span class="keywordtype">void</span> <a class="code" href="classPBase64.html#a2">ProcessEncoding</a>(00156 <span class="keyword">const</span> <span class="keywordtype">void</span> * dataBlock, <span class="comment">// Pointer to data to be encoded</span>00157 PINDEX length <span class="comment">// Length of the data block.</span>00158 );00159 <span class="comment">// Incorporate the specified data into the base 64 encoding.</span>00160 00166 <a class="code" href="classPString.html">PString</a> <a class="code" href="classPBase64.html#a6">GetEncodedString</a>();00167 00175 <a class="code" href="classPString.html">PString</a> <a class="code" href="classPBase64.html#a7">CompleteEncoding</a>();00176 00177 00178 <span class="keyword">static</span> <a class="code" href="classPString.html">PString</a> <a class="code" href="classPBase64.html#d0">Encode</a>(00179 <span class="keyword">const</span> <a class="code" href="classPString.html">PString</a> & str <span class="comment">// String to be encoded to Base64</span>00180 );00181 <span class="keyword">static</span> <a class="code" href="classPString.html">PString</a> <a class="code" href="classPBase64.html#d0">Encode</a>(00182 <span class="keyword">const</span> <span class="keywordtype">char</span> * cstr <span class="comment">// C String to be encoded to Base64</span>00183 );00184 <span class="keyword">static</span> <a class="code" href="classPString.html">PString</a> <a class="code" href="classPBase64.html#d0">Encode</a>(00185 <span class="keyword">const</span> <a class="code" href="classPBYTEArray.html">PBYTEArray</a> & data <span class="comment">// Data block to be encoded to Base64</span>00186 );00187 <span class="keyword">static</span> <a class="code" href="classPString.html">PString</a> <a class="code" href="classPBase64.html#d0">Encode</a>(00188 <span class="keyword">const</span> <span class="keywordtype">void</span> * dataBlock, <span class="comment">// Pointer to data to be encoded to Base64</span>00189 PINDEX length <span class="comment">// Length of the data block.</span>00190 );00191 <span class="comment">// Encode the data in memory to Base 64 data returnin the string.</span>00192 00193 00194 <span class="keywordtype">void</span> <a class="code" href="classPBase64.html#a8">StartDecoding</a>();00195 <span class="comment">// Begin a base 64 decoding operation, initialising the object instance.</span>00196 00202 BOOL <a class="code" href="classPBase64.html#a9">ProcessDecoding</a>(00203 <span class="keyword">const</span> <a class="code" href="classPString.html">PString</a> & str <span class="comment">// String to be encoded</span>00204 );00205 BOOL <a class="code" href="classPBase64.html#a9">ProcessDecoding</a>(00206 <span class="keyword">const</span> <span class="keywordtype">char</span> * cstr <span class="comment">// C String to be encoded</span>00207 );00208 00214 BOOL <a class="code" href="classPBase64.html#a12">GetDecodedData</a>(00215 <span class="keywordtype">void</span> * dataBlock, <span class="comment">// Pointer to data to be decoded from base64</span>00216 PINDEX length <span class="comment">// Length of the data block.</span>00217 );00218 <a class="code" href="classPBYTEArray.html">PBYTEArray</a> <a class="code" href="classPBase64.html#a12">GetDecodedData</a>();00219
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -