2015-02-05 20:57:01 +00:00
|
|
|
#include <getopt.h>
|
2015-02-05 16:36:25 +00:00
|
|
|
|
2015-02-07 16:18:07 -08:00
|
|
|
#include <iostream>
|
|
|
|
|
|
2015-02-05 16:36:25 +00:00
|
|
|
#include "crypto.h"
|
2015-02-05 11:38:34 +00:00
|
|
|
|
2015-02-05 20:57:01 +00:00
|
|
|
static const struct option long_options[] = {
|
|
|
|
|
{"secret_key_filename", required_argument, NULL, 's'},
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
int main(int argc, char *argv[]) {
|
|
|
|
|
std::string secret_key_filename;
|
|
|
|
|
{
|
|
|
|
|
int option, option_index;
|
|
|
|
|
while ((option = getopt_long(argc, argv, "s:", long_options, &option_index)) != -1) {
|
|
|
|
|
switch (option) {
|
|
|
|
|
case 's':
|
|
|
|
|
secret_key_filename = optarg;
|
|
|
|
|
break;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
std::string secret_key;
|
2015-02-07 14:32:53 -08:00
|
|
|
CryptoUtil::ReadKeyFromFile(secret_key_filename, &secret_key);
|
2015-02-05 20:57:01 +00:00
|
|
|
|
2015-02-07 16:44:42 +01:00
|
|
|
CryptoPubServer server(secret_key);
|
2015-02-05 16:36:25 +00:00
|
|
|
server.Loop();
|
2015-02-07 16:18:07 -08:00
|
|
|
|
|
|
|
|
std::cerr << "Shutting down" << std::endl;
|
2015-02-05 11:38:34 +00:00
|
|
|
}
|