GateKeeper.h
author Volker Birk <vb@pep-project.org>
Fri, 24 Jun 2016 21:32:46 +0200
changeset 126 8cf20db557f1
parent 123 6d311985ee41
child 129 9985c2d61311
permissions -rw-r--r--
download MSI
vb@88
     1
class CpEpCOMServerAdapterModule;
vb@88
     2
vb@107
     3
using namespace std;
vb@107
     4
vb@96
     5
namespace pEp {
vb@88
     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@123
    18
            uint8_t c_key[132];
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@89
    23
vb@117
    24
        GateKeeper(CpEpCOMServerAdapterModule * self);
vb@96
    25
        ~GateKeeper();
vb@88
    26
vb@96
    27
        CpEpCOMServerAdapterModule * const module() const
vb@96
    28
        {
vb@96
    29
            return _self;
vb@96
    30
        }
vb@88
    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@88
    38
vb@96
    39
        static const time_t cycle;
vb@96
    40
        static const DWORD waiting;
vb@96
    41
vb@96
    42
        static time_t time_diff();
vb@96
    43
vb@96
    44
        void keep_plugin();
vb@96
    45
vb@126
    46
        void install_msi(tstring filename);
vb@111
    47
        string update_key();
vb@116
    48
        BCRYPT_KEY_HANDLE delivery_key();
vb@121
    49
        string wrapped_delivery_key(BCRYPT_KEY_HANDLE hDeliveryKey);
vb@112
    50
vb@97
    51
        void update_product(product p, DWORD context);
vb@96
    52
        product_list& registered_products();
vb@96
    53
        void keep_updated();
vb@96
    54
vb@96
    55
    private:
vb@96
    56
        time_t now;
vb@96
    57
        time_t next;
vb@96
    58
        bool cu_open;
vb@96
    59
        HKEY cu;
vb@96
    60
        HKEY hkUpdater;
vb@97
    61
        HINTERNET internet;
vb@116
    62
        BCRYPT_ALG_HANDLE hAES;
vb@116
    63
        BCRYPT_ALG_HANDLE hRSA;
vb@96
    64
vb@110
    65
        CpEpCOMServerAdapterModule * _self;
vb@96
    66
    };
vb@96
    67
}