114 fprintf (stderr,
"%s",
_ (
"Shutting down...\n"));
146 fprintf (stdout,
_ (
"Key `%s' is valid\n"),
test_ego);
150 fprintf (stdout,
_ (
"Key `%s' has been revoked\n"),
test_ego);
154 fprintf (stdout,
"%s",
_ (
"Internal error\n"));
180 _ (
"Key for ego `%s' is still valid, revocation failed (!)\n"),
183 fprintf (stdout,
"%s",
_ (
"Revocation failed (!)\n"));
189 _ (
"Key for ego `%s' has been successfully revoked\n"),
192 fprintf (stdout,
"%s",
_ (
"Revocation successful.\n"));
198 _ (
"Internal error, key revocation might have failed\n"));
252 fprintf (stderr,
"%s",
_ (
"Cancelling calculation.\n"));
300 fprintf (stderr,
"%s",
"\n");
302 _ (
"Revocation certificate for `%s' stored in `%s'\n"),
334 fprintf (stdout,
_ (
"Ego `%s' not found.\n"),
revoke_ego);
350 _ (
"Error: Key is invalid\n"));
357 _ (
"Error: revocation certificate in `%s' is not for `%s'\n"),
367 fprintf (stderr,
"%s",
_ (
"Revocation certificate ready\n"));
379 _ (
"Continuing calculation where left off...\n"));
386 _ (
"Revocation certificate not ready, calculating proof of work\n"));
424 fprintf (stderr,
_ (
"Public key `%s' malformed\n"),
test_ego);
434 "Testing and revoking at the same time is not allowed, only executing test.\n"));
464 _ (
"No filename to store revocation certificate given.\n"));
481 _ (
"Failed to read revocation certificate from `%s'\n"),
489 _ (
"Revocation certificate corrupted in `%s'\n"),
511 fprintf (stderr,
"%s",
_ (
"No action specified. Nothing to do.\n"));
523main (
int argc,
char *
const *argv)
530 "use NAME for the name of the revocation file"),
538 "revoke the private key associated for the the private key associated with the ego NAME "),
545 "actually perform revocation, otherwise we just do the precomputation"),
552 "test if the public key KEY has been revoked"),
558 "number of epochs to calculate for"),
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
struct GNUNET_GETOPT_CommandLineOption options[]
#define gettext_noop(String)
struct GNUNET_HashCode key
The key used in the DHT.
struct GNUNET_CRYPTO_PrivateKey pk
Private key from command line option, or NULL.
static char * test_ego
-t option.
static struct GNUNET_REVOCATION_Query * q
Handle for revocation query.
static unsigned int pow_passes
Pow passes.
static struct GNUNET_TIME_Relative epoch_duration
Epoch length.
static const struct GNUNET_CONFIGURATION_Handle * cfg
Our configuration.
static void print_revocation_result(void *cls, int is_valid)
Print the result from a revocation request.
static unsigned long long matching_bits
Number of matching bits required for revocation.
static void ego_callback(void *cls, struct GNUNET_IDENTITY_Ego *ego)
Function called with the result from the ego lookup.
static struct GNUNET_GNSRECORD_PowP * proof_of_work
Proof-of-work object.
static int ret
Final status code.
static void do_shutdown(void *cls)
Function run if the user aborts with CTRL-C.
static struct GNUNET_IDENTITY_EgoLookup * el
Handle for our ego lookup.
static int perform
Was "-p" specified?
static unsigned int epochs
-e option.
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
Main function that will be run by the scheduler.
static struct GNUNET_SCHEDULER_Task * pow_task
Task used for proof-of-work calculation.
static void print_query_result(void *cls, int is_valid)
Print the result from a revocation query.
static void calculate_pow(void *cls)
Perform the proof-of-work calculation.
static struct GNUNET_REVOCATION_Handle * h
Handle for revocation.
static void calculate_pow_shutdown(void *cls)
Perform the proof-of-work calculation.
int main(int argc, char *const *argv)
The main function of gnunet-revocation.
static void sync_pow()
Write the current state of the revocation data to disk.
static char * revoke_ego
-R option
static char * filename
-f option.
static void perform_revocation()
Perform the revocation.
API that can be used to manipulate GNS record data.
API to perform and access key revocations.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_number(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, unsigned long long *number)
Get a configuration value that should be a number.
enum GNUNET_GenericReturnValue GNUNET_CONFIGURATION_get_value_time(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *section, const char *option, struct GNUNET_TIME_Relative *time)
Get a configuration value that should be a relative time.
enum GNUNET_GenericReturnValue GNUNET_DISK_file_test(const char *fil)
Check that fil corresponds to a filename (of a file that exists and that is not a directory).
enum GNUNET_GenericReturnValue GNUNET_DISK_fn_write(const char *fn, const void *buf, size_t buf_size, enum GNUNET_DISK_AccessPermissions mode)
Write a buffer to a file atomically.
enum GNUNET_GenericReturnValue GNUNET_DISK_directory_remove(const char *filename)
Remove all files in a directory (rm -rf).
ssize_t GNUNET_DISK_fn_read(const char *fn, void *result, size_t len)
Read the contents of a binary file into a buffer.
@ GNUNET_DISK_PERM_USER_READ
Owner can read.
@ GNUNET_DISK_PERM_USER_WRITE
Owner can write.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_uint(char shortName, const char *name, const char *argumentHelp, const char *description, unsigned int *val)
Allow user to specify an unsigned int.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_flag(char shortName, const char *name, const char *description, int *val)
Allow user to specify a flag (which internally means setting an integer to 1/GNUNET_YES/GNUNET_OK.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_string(char shortName, const char *name, const char *argumentHelp, const char *description, char **str)
Allow user to specify a string.
size_t GNUNET_GNSRECORD_proof_get_size(const struct GNUNET_GNSRECORD_PowP *pow)
void GNUNET_GNSRECORD_pow_stop(struct GNUNET_GNSRECORD_PowCalculationHandle *pc)
Stop a PoW calculation.
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_pow_round(struct GNUNET_GNSRECORD_PowCalculationHandle *pc)
Calculate a single round in the key revocation PoW.
void GNUNET_GNSRECORD_pow_init(const struct GNUNET_CRYPTO_PrivateKey *key, struct GNUNET_GNSRECORD_PowP *pow)
Initializes a fresh PoW computation.
struct GNUNET_GNSRECORD_PowCalculationHandle * GNUNET_GNSRECORD_pow_start(struct GNUNET_GNSRECORD_PowP *pow, int epochs, unsigned int difficulty)
Starts a proof-of-work calculation given the pow object as well as target epochs and difficulty.
#define GNUNET_MAX_POW_SIZE
Maximum length of a revocation.
enum GNUNET_GenericReturnValue GNUNET_GNSRECORD_check_pow(const struct GNUNET_GNSRECORD_PowP *pow, unsigned int matching_bits, struct GNUNET_TIME_Relative epoch_duration)
Check if the given proof-of-work is valid.
const struct GNUNET_CRYPTO_PrivateKey * GNUNET_IDENTITY_ego_get_private_key(const struct GNUNET_IDENTITY_Ego *ego)
Obtain the ECC key associated with a ego.
struct GNUNET_IDENTITY_EgoLookup * GNUNET_IDENTITY_ego_lookup(const struct GNUNET_CONFIGURATION_Handle *cfg, const char *name, GNUNET_IDENTITY_EgoCallback cb, void *cb_cls)
Lookup an ego by name.
void GNUNET_IDENTITY_ego_lookup_cancel(struct GNUNET_IDENTITY_EgoLookup *el)
Abort ego lookup attempt.
void GNUNET_IDENTITY_ego_get_public_key(struct GNUNET_IDENTITY_Ego *ego, struct GNUNET_CRYPTO_PublicKey *pk)
Get the identifier (public key) of an ego.
ssize_t GNUNET_CRYPTO_public_key_get_length(const struct GNUNET_CRYPTO_PublicKey *key)
Get the compacted length of a GNUNET_CRYPTO_PublicKey.
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_public_key_from_string(const char *str, struct GNUNET_CRYPTO_PublicKey *key)
Parses a (Base32) string representation of the public key.
#define GNUNET_break(cond)
Use this for internal assertion violations that are not fatal (can be handled) but should not occur.
void GNUNET_log_config_missing(enum GNUNET_ErrorType kind, const char *section, const char *option)
Log error message about missing configuration option.
#define GNUNET_log_strerror_file(level, cmd, filename)
Log an error message at log-level 'level' that indicates a failure of the command 'cmd' with the mess...
@ GNUNET_ERROR_TYPE_ERROR
#define GNUNET_malloc(size)
Wrapper around malloc.
const struct GNUNET_OS_ProjectData * GNUNET_OS_project_data_gnunet(void)
Return default project data used by 'libgnunetutil' for GNUnet.
enum GNUNET_GenericReturnValue GNUNET_PROGRAM_run(const struct GNUNET_OS_ProjectData *pd, int argc, char *const *argv, const char *binaryName, const char *binaryHelp, const struct GNUNET_GETOPT_CommandLineOption *options, GNUNET_PROGRAM_Main task, void *task_cls)
Run a standard GNUnet command startup sequence (initialize loggers and configuration,...
struct GNUNET_REVOCATION_Handle * GNUNET_REVOCATION_revoke(const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_GNSRECORD_PowP *pow, GNUNET_REVOCATION_Callback func, void *func_cls)
Perform key revocation.
void GNUNET_REVOCATION_query_cancel(struct GNUNET_REVOCATION_Query *q)
Cancel key revocation check.
void GNUNET_REVOCATION_revoke_cancel(struct GNUNET_REVOCATION_Handle *h)
Cancel key revocation.
struct GNUNET_REVOCATION_Query * GNUNET_REVOCATION_query(const struct GNUNET_CONFIGURATION_Handle *cfg, const struct GNUNET_CRYPTO_PublicKey *key, GNUNET_REVOCATION_Callback func, void *func_cls)
Check if a key was revoked.
void GNUNET_SCHEDULER_shutdown(void)
Request the shutdown of a scheduler.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_shutdown(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run on shutdown, that is when a CTRL-C signal is received,...
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_now(GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run as soon as possible.
struct GNUNET_SCHEDULER_Task * GNUNET_SCHEDULER_add_delayed(struct GNUNET_TIME_Relative delay, GNUNET_SCHEDULER_TaskCallback task, void *task_cls)
Schedule a new task to be run with a specified delay.
#define GNUNET_TIME_UNIT_MILLISECONDS
One millisecond.
A private key for an identity as per LSD0001.
An identity key as per LSD0001.
Definition of a command line option.
The handle to a PoW calculation.
Struct for a proof of work as part of the revocation.
Handle for the key revocation operation.
Handle for the key revocation query.
Entry in list of pending tasks.
Time for relative time used by GNUnet, in microseconds.