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

📄 encryptengine.h

📁 五行MMORPG引擎系统V1.0
💻 H
字号:
// EncryptEngine.h
/*/////////////////////////////////////////////////////////////////////////////

	李亦
	2006.06.
/*//////////////////////////////////////////////////////////////////////////////

#ifndef __INC_ENCRYPTENGINE_H
#define __INC_ENCRYPTENGINE_H

// Encryption interface


#ifndef _CSDEFINE_H_
#include "server/CSDefine.h"
#endif

namespace CS
{

#define INVALID_ENCRYPTION_ENGINE	((CS_ENCRYPTHANDLER *)NULL)
#define MAX_ENCRYPTION_ENGINES		8


#pragma pack(push, 1)
typedef struct _tagEncryptHandler
{
	int	(RPGAPI2 *pInsert)		(void);
	int	(RPGAPI2 *pRemove)		(void);
	char *(RPGAPI2 *pQuery)			(void);

	void *(RPGAPI2 *pStartup)		(void);
	int	(RPGAPI2 *pShutdown)		(void *pInternal);
	int	(RPGAPI2 *pSetEncryptKey)(void *pInternal, char *svKey);
	int	(RPGAPI2 *pSetDecryptKey)(void *pInternal, char *svKey);
	char *(RPGAPI2 *pGetEncryptKey)(void *pInternal);
	char *(RPGAPI2 *pGetDecryptKey)(void *pInternal);
	BYTE *(RPGAPI2 *pEncrypt)		(void *pInternal, BYTE *pBuffer,int nBufLen,int *pnOutBufLen);
	BYTE *(RPGAPI2 *pDecrypt)		(void *pInternal, BYTE *pBuffer,int nBufLen,int *pnOutBufLen);
	int	(RPGAPI2 *pCreateNewKeys)(void *pInternal);
	void	(RPGAPI2 *pFree)			(void *pInternal, BYTE *pBuffer);
} CS_ENCRYPTHANDLER;
#pragma pack(pop)



class CEncryptionEngine 
{
public:


protected:
	CS_ENCRYPTHANDLER		*m_pEngine;
	void						*m_pData;

public:
	virtual char	*Query(void);
	virtual int		Startup(void);
	virtual int		Shutdown(void);
	virtual int		SetEncryptKey(char *pKey);
	virtual int		SetDecryptKey(char *pKey);
	virtual char	*GetEncryptKey(void);
	virtual char	*GetDecryptKey(void);
	virtual BYTE	*Encrypt(BYTE *pBuffer,int nBufLen, int *pnOutBufLen);
	virtual BYTE	*Decrypt(BYTE *pBuffer,int nBufLen, int *pnOutBufLen);
	virtual int		CreateNewKeys(void);
	virtual void	Free(BYTE *pBuffer);

public:
	CEncryptionEngine(CS_ENCRYPTHANDLER *pEngine);
	virtual ~CEncryptionEngine();
};







class CEncryptHandlerManager 
{

protected:
	CS_ENCRYPTHANDLER		*m_pEncryptionEngines[MAX_ENCRYPTION_ENGINES];
	
public:
	virtual int		Insert(CS_ENCRYPTHANDLER *engine);
	virtual int		GetEngineCount(void);
	virtual char	*Query(int nEngine);
	virtual int		Remove(int nEngine);

	virtual CS_ENCRYPTHANDLER *GetEngine(int nEngine);
	virtual CS_ENCRYPTHANDLER *GetEngineByID(char *svID);

public:
	CEncryptHandlerManager();
	virtual ~CEncryptHandlerManager();

};



};//namespace CS

#endif

⌨️ 快捷键说明

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