author | Volker Birk <vb@pep-project.org> |
Mon, 14 Nov 2016 12:28:07 +0100 | |
changeset 214 | 25aaaf97917f |
parent 208 | 35eb7b0492ac |
child 228 | 3419c95178c0 |
permissions | -rw-r--r-- |
vb@88 | 1 |
class CpEpCOMServerAdapterModule; |
vb@88 | 2 |
|
vb@107 | 3 |
using namespace std; |
vb@107 | 4 |
|
vb@96 | 5 |
namespace pEp { |
vb@96 | 6 |
|
vb@96 | 7 |
#ifdef UNICODE |
vb@107 | 8 |
typedef wstring tstring; |
vb@96 | 9 |
#else |
vb@107 | 10 |
typedef string tstring; |
vb@96 | 11 |
#endif |
vb@88 | 12 |
|
vb@96 | 13 |
class GateKeeper { |
vb@96 | 14 |
public: |
vb@107 | 15 |
typedef pair<tstring, tstring> product; |
vb@107 | 16 |
typedef vector< product > product_list; |
vb@112 | 17 |
union aeskey_t { |
vb@129 | 18 |
uint8_t c_key[32]; |
vb@123 | 19 |
uint16_t w_key[16]; |
vb@123 | 20 |
uint32_t dw_key[8]; |
vb@123 | 21 |
uint64_t qw_key[4]; |
vb@112 | 22 |
}; |
vb@96 | 23 |
|
vb@117 | 24 |
GateKeeper(CpEpCOMServerAdapterModule * self); |
vb@96 | 25 |
~GateKeeper(); |
vb@96 | 26 |
|
vb@96 | 27 |
CpEpCOMServerAdapterModule * const module() const |
vb@96 | 28 |
{ |
vb@96 | 29 |
return _self; |
vb@96 | 30 |
} |
vb@96 | 31 |
|
vb@96 | 32 |
void keep(); |
vb@88 | 33 |
|
vb@96 | 34 |
protected: |
vb@96 | 35 |
static const LPCTSTR plugin_reg_path; |
vb@96 | 36 |
static const LPCTSTR plugin_reg_value_name; |
vb@96 | 37 |
static const LPCTSTR updater_reg_path; |
vb@89 | 38 |
|
vb@96 | 39 |
static const time_t cycle; |
vb@137 | 40 |
static const time_t fraction; |
vb@96 | 41 |
static const DWORD waiting; |
vb@88 | 42 |
|
vb@96 | 43 |
static time_t time_diff(); |
vb@96 | 44 |
|
vb@96 | 45 |
void keep_plugin(); |
vb@88 | 46 |
|
vb@126 | 47 |
void install_msi(tstring filename); |
vb@111 | 48 |
string update_key(); |
vb@116 | 49 |
BCRYPT_KEY_HANDLE delivery_key(); |
vb@121 | 50 |
string wrapped_delivery_key(BCRYPT_KEY_HANDLE hDeliveryKey); |
vb@112 | 51 |
|
vb@97 | 52 |
void update_product(product p, DWORD context); |
vb@214 | 53 |
product_list registered_products(); |
vb@96 | 54 |
void keep_updated(); |
vb@208 | 55 |
static tstring get_lockFile(); |
vb@88 | 56 |
|
vb@96 | 57 |
private: |
vb@96 | 58 |
time_t now; |
vb@96 | 59 |
time_t next; |
vb@96 | 60 |
bool cu_open; |
vb@96 | 61 |
HKEY cu; |
vb@96 | 62 |
HKEY hkUpdater; |
vb@141 | 63 |
HKEY hkPluginStart; |
vb@97 | 64 |
HINTERNET internet; |
vb@116 | 65 |
BCRYPT_ALG_HANDLE hAES; |
vb@116 | 66 |
BCRYPT_ALG_HANDLE hRSA; |
vb@88 | 67 |
|
vb@110 | 68 |
CpEpCOMServerAdapterModule * _self; |
vb@96 | 69 |
}; |
vb@96 | 70 |
} |