2015-06-14 00:46:21 +00:00
|
|
|
/* Benjamin DELPY `gentilkiwi`
|
|
|
|
http://blog.gentilkiwi.com
|
|
|
|
benjamin@gentilkiwi.com
|
2015-08-25 09:19:01 +00:00
|
|
|
Licence : https://creativecommons.org/licenses/by/4.0/
|
2015-06-14 00:46:21 +00:00
|
|
|
*/
|
|
|
|
#pragma once
|
|
|
|
#include "globals.h"
|
2015-06-18 00:18:17 +00:00
|
|
|
#include "kull_m_dpapi.h"
|
2015-06-14 00:46:21 +00:00
|
|
|
#include "kull_m_string.h"
|
|
|
|
|
|
|
|
#define KIWI_DPAPI_ENTROPY_CAPI_KEY_EXPORTFLAGS "Hj1diQ6kpUx7VC4m"
|
|
|
|
#define KIWI_DPAPI_ENTROPY_CNG_KEY_PROPERTIES "6jnkd5J3ZdQDtrsu"
|
|
|
|
#define KIWI_DPAPI_ENTROPY_CNG_KEY_BLOB "xT5rZW5qVVbrvpuA"
|
|
|
|
|
2015-07-14 23:13:21 +00:00
|
|
|
//#define KIWI_DPAPI_ENTROPY_NGC_unk 0x62 6B ED CB CA 02 5E 41 84 7E 33 93 36 9C 2E 5E
|
|
|
|
|
2015-06-14 00:46:21 +00:00
|
|
|
#pragma pack(push, 4)
|
|
|
|
typedef struct _KULL_M_KEY_CAPI_BLOB {
|
|
|
|
DWORD dwVersion;
|
|
|
|
DWORD unk0; // maybe flags somewhere ?
|
|
|
|
DWORD dwNameLen;
|
2016-01-12 02:13:12 +00:00
|
|
|
DWORD dwSiPublicKeyLen;
|
|
|
|
DWORD dwSiPrivateKeyLen;
|
|
|
|
DWORD dwExPublicKeyLen;
|
|
|
|
DWORD dwExPrivateKeyLen;
|
2015-06-14 00:46:21 +00:00
|
|
|
DWORD dwHashLen; // hmac ?
|
2016-01-12 02:13:12 +00:00
|
|
|
DWORD dwSiExportFlagLen;
|
|
|
|
DWORD dwExExportFlagLen;
|
2015-06-14 00:46:21 +00:00
|
|
|
|
|
|
|
PSTR pName;
|
|
|
|
PVOID pHash;
|
2016-01-12 02:13:12 +00:00
|
|
|
PVOID pSiPublicKey;
|
|
|
|
PVOID pSiPrivateKey;
|
|
|
|
PVOID pSiExportFlag;
|
|
|
|
PVOID pExPublicKey;
|
|
|
|
PVOID pExPrivateKey;
|
|
|
|
PVOID pExExportFlag;
|
2015-06-14 00:46:21 +00:00
|
|
|
} KULL_M_KEY_CAPI_BLOB, *PKULL_M_KEY_CAPI_BLOB;
|
|
|
|
|
|
|
|
typedef struct _KULL_M_KEY_CNG_PROPERTY {
|
|
|
|
DWORD dwStructLen;
|
|
|
|
DWORD type;
|
|
|
|
DWORD unk;
|
|
|
|
DWORD dwNameLen;
|
|
|
|
DWORD dwPropertyLen;
|
|
|
|
|
|
|
|
PSTR pName;
|
|
|
|
PVOID pProperty;
|
|
|
|
} KULL_M_KEY_CNG_PROPERTY, *PKULL_M_KEY_CNG_PROPERTY;
|
|
|
|
|
|
|
|
typedef struct _KULL_M_KEY_CNG_BLOB {
|
|
|
|
DWORD dwVersion;
|
|
|
|
DWORD unk; // maybe flags somewhere ?
|
|
|
|
DWORD dwNameLen;
|
|
|
|
DWORD type;
|
|
|
|
DWORD dwPublicPropertiesLen;
|
|
|
|
DWORD dwPrivatePropertiesLen;
|
|
|
|
DWORD dwPrivateKeyLen;
|
|
|
|
BYTE unkArray[16];
|
|
|
|
|
|
|
|
PSTR pName;
|
|
|
|
|
|
|
|
DWORD cbPublicProperties;
|
|
|
|
PKULL_M_KEY_CNG_PROPERTY *pPublicProperties;
|
|
|
|
|
|
|
|
PVOID pPrivateProperties;
|
|
|
|
PVOID pPrivateKey;
|
|
|
|
} KULL_M_KEY_CNG_BLOB, *PKULL_M_KEY_CNG_BLOB;
|
2015-07-14 23:13:21 +00:00
|
|
|
#pragma pack(pop)
|
2015-06-14 00:46:21 +00:00
|
|
|
|
|
|
|
PKULL_M_KEY_CAPI_BLOB kull_m_key_capi_create(PVOID data/*, DWORD size*/);
|
|
|
|
void kull_m_key_capi_delete(PKULL_M_KEY_CAPI_BLOB capiKey);
|
2015-06-18 00:18:17 +00:00
|
|
|
void kull_m_key_capi_descr(DWORD level, PKULL_M_KEY_CAPI_BLOB capiKey);
|
2015-06-14 00:46:21 +00:00
|
|
|
BOOL kull_m_key_capi_write(PKULL_M_KEY_CAPI_BLOB capiKey, PVOID *data, DWORD *size);
|
2015-06-18 00:18:17 +00:00
|
|
|
BOOL kull_m_key_capi_decryptedkey_to_raw(LPCVOID decrypted, DWORD decryptedLen, PRSA_GENERICKEY_BLOB *blob, DWORD *blobLen);
|
2015-06-14 00:46:21 +00:00
|
|
|
|
|
|
|
PKULL_M_KEY_CNG_BLOB kull_m_key_cng_create(PVOID data/*, DWORD size*/);
|
|
|
|
void kull_m_key_cng_delete(PKULL_M_KEY_CNG_BLOB cngKey);
|
2015-06-18 00:18:17 +00:00
|
|
|
void kull_m_key_cng_descr(DWORD level, PKULL_M_KEY_CNG_BLOB cngKey);
|
2015-06-14 00:46:21 +00:00
|
|
|
//
|
|
|
|
PKULL_M_KEY_CNG_PROPERTY kull_m_key_cng_property_create(PVOID data/*, DWORD size*/);
|
|
|
|
void kull_m_key_cng_property_delete(PKULL_M_KEY_CNG_PROPERTY property);
|
2015-06-18 00:18:17 +00:00
|
|
|
void kull_m_key_cng_property_descr(DWORD level, PKULL_M_KEY_CNG_PROPERTY property);
|
2015-06-14 00:46:21 +00:00
|
|
|
//
|
|
|
|
BOOL kull_m_key_cng_properties_create(PVOID data, DWORD size, PKULL_M_KEY_CNG_PROPERTY ** properties, DWORD *count);
|
|
|
|
void kull_m_key_cng_properties_delete(PKULL_M_KEY_CNG_PROPERTY *properties, DWORD count);
|
2015-06-18 00:18:17 +00:00
|
|
|
void kull_m_key_cng_properties_descr(DWORD level, PKULL_M_KEY_CNG_PROPERTY *properties, DWORD count);
|
2015-06-14 00:46:21 +00:00
|
|
|
//
|