📄 xtunnelscvsaes.h
字号:
/* File: XTunnelsCVsAES.h Contains: AES routines Copyright: (c) 2003 by Xten Networks, Inc., all rights reserved.*/#ifndef CVSAES_H__FCA29308_FD3E_460B_8492_1AD129ADFBC4_#define CVSAES_H__FCA29308_FD3E_460B_8492_1AD129ADFBC4_#ifdef __MWERKS__#pragma once#endif // __MWERKS__#include <iostream>#include <strstream>struct STAESPrivateData;class CVsAES{public: enum AESKeyLength { E128bits = 128, E192bits = 192, E256bits = 256 };public: CVsAES() {Init();} virtual ~CVsAES() {Destroy();} unsigned long GetBlockSize() {return sizeof(unsigned char)*16;} void OpenRead( // for decrypting const char * szKey, std::istrstream *ipInputStream, CVsAES::AESKeyLength eKeyLength ); void OpenWrite( // for encrypting const char * szKey, std::ostrstream *ipOuputStream, CVsAES::AESKeyLength eKeyLength ); 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 16 bytes depending on the encryption scheme choosen. // 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: STAESPrivateData *m_pData; std::istrstream *m_iStream; std::ostrstream *m_oStream; bool m_bReadMode;};#endif //CVSAES_H__FCA29308_FD3E_460B_8492_1AD129ADFBC4_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -