?? xtunnelscvsdes.h
字號:
/* File: XTunnelsCVsDES.h Contains: DES routines Copyright: (c) 2003 by Xten Networks, Inc., all rights reserved.*/#ifndef CVSDES_H__29AB99C3_80C0_475e_80BB_19AC81E50D44_#define CVSDES_H__29AB99C3_80C0_475e_80BB_19AC81E50D44_#ifdef __MWERKS__#pragma once#endif // __MWERKS__#include <iostream>#include <strstream>struct STDESPrivateData;class CVsDES{public: enum DESMode { DES = 1, DES2 = 2, TripleDES = 3 }; enum DESLength { SingleLength = 1, DoubleLength = 2, TripleLength = 3 };public: CVsDES() {Init();} virtual ~CVsDES() {Destroy();} unsigned long GetBlockSize() {return sizeof(unsigned long);} void OpenRead( // for decrypting const char * szKey, std::istrstream *ipInputStream, DESMode eMode = TripleDES, // default maximum encryption DESLength eLength = TripleLength // default maximum length blocks ); void OpenWrite( // for encrypting const char * szKey, std::ostrstream *ipOuputStream, DESMode eMode = TripleDES, DESLength eLength = TripleLength // default maximum length blocks ); virtual bool Read( char *pbyBuffer, unsigned long dwBytesToRead, unsigned long *pBytesRead = NULL ); virtual bool Write( const char *pBuffer, unsigned long dwBufferLength, unsigned long *pBytesWritten = NULL ); // WARNING: The last write before a close will be padded with zeros and aligned to the // nearest 8, 16 or 32 bits depending on the encryption scheme choosen (SingleLength, // DoubleLength, TripleLength). These zeros will be part of the output stream, and // nothing can be done about it. When you read back the decrypted stream, you will see // these padded zeros at the end of the stream read block. virtual void Close(unsigned long *pBytesWritten = NULL);private: void Init(); void Destroy();private: STDESPrivateData *m_pData; std::istrstream *m_iStream; std::ostrstream *m_oStream; bool m_bReadMode;};#endif //CVSDES_H__29AB99C3_80C0_475e_80BB_19AC81E50D44_
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -