-
January 31st, 2000, 10:58 AM
#1
Structure of HCRYPTKEY Data
Does anybody now, what is a BYTE structure of
HCRYPTKEY handle
-
January 31st, 2020, 06:33 AM
#2
Re: Structure of HCRYPTKEY Data
Hi
it's been some time since you asked this question, but if you're still looking for the answer, here it is. I'm not sure how it's done in Windows 98 which you probably had in mind, but for all the versions since XP to 10 it looks like below. It all comes from reverse engineering of cryptsp.dll and rsaenh.dll, so it's not perfect, but gives the brief overview of its internals:
Code:
struct HCRYPTKEY
{
void* CPGenKey;
void* CPDeriveKey;
void* CPDestroyKey;
void* CPSetKeyParam;
void* CPGetKeyParam;
void* CPExportKey;
void* CPImportKey;
void* CPEncrypt;
void* CPDecrypt;
void* CPDuplicateKey;
HCRYPTPROV hCryptProv;
magic_s *magic; // XOR-ed
};
First 10 fields are pointers to functions from rsaenh.dll which are just internal implementations of crypto api functions.
I'm not very sure of the structure of magic_s, but the only interesting field there is pointer to another structure containing key data:
Code:
struct magic_s
{
key_data_s *key_data;
};
struct key_data_s
{
void *unknown; // XOR-ed
uint32_t alg;
uint32_t flags;
uint32_t key_size;
void* key_bytes;
};
All those structures are probably a little bit longer and contain additional fields, but I'm not sure about their purpose as it was not necessary for my research.
Also notice pointers commented as XOR - their values are XOR-ed with magic constant equal to 0xE35A172C, so you must "unxor" them before using.
All of above is true for 32 bit version of cryptsp.dll / rsaenh.dll
Last edited by 2kaud; January 31st, 2020 at 06:45 AM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|