2023-11-08 20:29:53 +08:00
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <windows.h>
|
|
|
|
#include "CryptoContext.h"
|
|
|
|
|
|
|
|
class CKeyPair
|
|
|
|
{
|
|
|
|
private:
|
2024-05-23 22:26:18 +08:00
|
|
|
static DWORD ms_dwRSAKeySize;
|
|
|
|
|
2023-11-08 20:29:53 +08:00
|
|
|
HCRYPTKEY m_hCryptKey;
|
|
|
|
CCryptoContext* m_pContext;
|
|
|
|
|
|
|
|
public:
|
|
|
|
CKeyPair(CCryptoContext* pContext);
|
|
|
|
~CKeyPair(void);
|
|
|
|
|
2024-05-23 23:22:12 +08:00
|
|
|
#ifdef ARCTOOL
|
|
|
|
void GenerateKey();
|
|
|
|
void LoadFromFile(PCHAR szFileName);
|
|
|
|
void WriteToFile(PCHAR szFileName);
|
|
|
|
void WriteCHeaderFile(PCHAR szFileName);
|
|
|
|
#endif
|
|
|
|
|
2023-11-08 20:29:53 +08:00
|
|
|
void LoadFromMemory(DWORD dwPubKeySize, BYTE* pbPubKeyBlob, BYTE bytXORKey);
|
|
|
|
void ReleaseKey();
|
|
|
|
|
|
|
|
HCRYPTKEY GetContainer();
|
|
|
|
};
|