📄 cryptit.h
字号:
#pragma once
#include "rsaeuro.h"
#include "atlstr.h"
class CryptIt
{
public:
CryptIt();
virtual ~CryptIt();
public:
//生成RSA Bit 位的key
bool CreateRsaKeyPair ( unsigned long ulBit = 1024 );
//保存rsaKeys_保存为一个文件
bool SaveRsaKeys(char* filename,R_RSA_PUBLIC_KEY publicKey,R_RSA_PRIVATE_KEY privateKey);
//取得rsaKeys
bool LodeRsaKeys(char* filename,R_RSA_PUBLIC_KEY * publicKey,R_RSA_PRIVATE_KEY * privateKey);
public:
//保存RSA Key_分开保存
bool SavePublicKey( char *strFileName, R_RSA_PUBLIC_KEY publicKey );
bool SavePrivateKey( char *strFileName ,R_RSA_PRIVATE_KEY privateKey);
//加载RSA key
bool LoadPulicKey( char *strFileName , R_RSA_PUBLIC_KEY *publicKey);
bool LoadPrivateKey( char *strFileName ,R_RSA_PRIVATE_KEY * privateKey);
public:
//用RSA加密Buf
bool RSAPrivateEncode( unsigned char *strIn,const unsigned int iInEncodeLength, unsigned char *strOut , unsigned int *iOutEncodeLength,R_RSA_PRIVATE_KEY *);
//用RSA解密Buf
bool RsaPublicDecode( unsigned char *strIn,const unsigned int iInDeodeLength, unsigned char *strOut , unsigned int *iOutDecodeLength,R_RSA_PUBLIC_KEY *);
public:
//用RSA用公钥加密加密Buf
bool RSAPublicEncode( unsigned char *strIn,const unsigned int iInEncodeLength, unsigned char *strOut , unsigned int *iOutEncodeLength,R_RSA_PUBLIC_KEY *);
//用RSA用私钥解密Buf
bool RsaPrivateDecode( unsigned char *strIn,const unsigned int iInDeodeLength, unsigned char *strOut , unsigned int *iOutDecodeLength,R_RSA_PRIVATE_KEY *);
//DES3
//用DES3加密
bool Des3Encode( char *strIn,int inlength, char *strOut,int *outlength,char* strKey );
//用Des3解密
bool Des3Decode( char *strIn, int inlength, char *strOut,int *outlength,char* strKey );
//MD5
bool Md5Hash( unsigned char *strIn, char *strOut );
//RC4
//RC4生成密钥
bool RC4Makey(unsigned char *key,int keylength= 256);
//RC4加密解密
bool RC4Code( unsigned char *data, int lDataength,unsigned char *key, int lKeyength );
public:
//公匙
R_RSA_PUBLIC_KEY PublicKey;
//私匙
R_RSA_PRIVATE_KEY PrivateKey;
//DES3密匙
CString DesKey;
//RC4
struct rc4_state s;
};
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -