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

📄 crypt.h

📁 实现通信过程中的数据加密(AES, DES, SHA-256,SHA-384,SHA512, RSA)。 测试加解密效率等
💻 H
字号:
// Crypt.h: interface for the CCrypt class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_CRYPT_H__592DEE7E_EA34_40FA_8144_93A7ABBDA4D0__INCLUDED_)
#define AFX_CRYPT_H__592DEE7E_EA34_40FA_8144_93A7ABBDA4D0__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "randpool.h"
#include "rsa.h"
#include "dsa.h"
#include "aes.h"
#include "sha.h"
#include "des.h"
#include "hex.h"
#include "modes.h"
#include "default.h"
#include "files.h"
#include "string"

using namespace CryptoPP;
using namespace std;
#pragma comment(lib, "cryptlib.lib")

class CCrypt  
{
public:
	CCrypt();
	virtual ~CCrypt();
public:
	void    setRsaPubFilename(const string &filename);
	void    setRsaPriFilename(const string &filename);
	void    setCreateKeySeed(const string &seed);
	void    setRsaEncryptSeed(const string &seed);
	void    setDesKey(const string &key);
	void    setRsaKeyLength(const int &len);
	void    setRsaDecryptor(void);
	void    setRsaEncryptor(void);
	void    setAesKey(const string &key);
	string  getRsaPubFilename(void);
	string  getRsaPriFilename(void);
	string  getCreateKeySeed(void);
	string  getRsaEncryptSeed(void);
	string  getDesKey(void);
	int     getRsaKeyLength(void);
	int     rsaCreateKey(void);
	string  desEncrypt(const char *message);
	string  desDecrypt(const char *Ciphertext);
	string  aesEncrypt(const char *message);
	string  aesDecrypt(const char *message);
	string  rsaEncrypt(const char *message);
	string  rsaDecrypt(const char *Ciphertext);
	void    shaEncrypt(const char *message, byte *Ciphertext);
	void    sha256Encrypt(const char *message, byte *Ciphertext);
	void    sha512Encrypt(const char *message, byte *Ciphertext);
	void    sha384Encrypt(const char *message, byte *Ciphertext);

private:
    string  strRsaPubFilename;
	string  strRsaPriFilename;
	string  strCreateKeySeed;
	string  strRsaEncryptSeed;
	string  strDesKey;
	string  strAesKey;
	int     nRsaKeyLength;
	RSAES_OAEP_SHA_Decryptor rsa_priv;
	RSAES_OAEP_SHA_Encryptor rsa_pub;
};

#endif // !defined(AFX_CRYPT_H__592DEE7E_EA34_40FA_8144_93A7ABBDA4D0__INCLUDED_)

⌨️ 快捷键说明

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