Exemplo n.º 1
0
    int do_main(int argc, char ** argv,
            get_hmac_key_prototype * hmac_fn,
            get_trace_key_prototype * trace_fn)
    {
        Inifile ini;
        { ConfigurationLoader cfg_loader_full(ini.configuration_holder(), CFG_PATH "/" RDPPROXY_INI); }

        UdevRandom rnd;
        CryptoContext cctx(rnd, ini);
        cctx.set_get_hmac_key_cb(hmac_fn);
        cctx.set_get_trace_key_cb(trace_fn);

        int res = -1;
        try {
            res = app_decrypter(
                argc, argv
              , "ReDemPtion DECrypter " VERSION ".\n"
                "Copyright (C) Wallix 2010-2015.\n"
                "Christophe Grosjean, Raphael Zhou."
              , cctx);
            if (res == 0){
                printf("decrypt ok");
            }
            else {
                printf("decrypt failed\n");
            }
        } catch (const Error & e) {
            printf("decrypt failed: with id=%d\n", e.id);
        }
        return res;
    }
Exemplo n.º 2
0
int main(int argc, char ** argv) {
    return app_decrypter(
        argc, argv
      , "ReDemPtion DECrypter " VERSION ".\n"
        "Copyright (C) Wallix 2010-2015.\n"
        "Christophe Grosjean, Raphael Zhou."
      , [](CryptoContext & cctx) {
            cfg::crypto::key0 key0;
            cfg::crypto::key1 key1;
            memcpy(cctx.crypto_key, key0.value, sizeof(cctx.crypto_key));
            memcpy(cctx.hmac_key,   key1.value, sizeof(cctx.hmac_key  ));
            return 0;
        }
    );
}