GNUnet  0.11.x
Functions | Variables
gnunet-reclaim.c File Reference

Identity Provider utility. More...

#include "platform.h"
#include <inttypes.h>
#include "gnunet_util_lib.h"
#include "gnunet_identity_service.h"
#include "gnunet_namestore_service.h"
#include "gnunet_reclaim_service.h"
#include "gnunet_signatures.h"
Include dependency graph for gnunet-reclaim.c:

Go to the source code of this file.

Functions

static void do_cleanup (void *cls)
 
static void ticket_issue_cb (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
 
static void store_cont (void *cls, int32_t success, const char *emsg)
 
static void process_attrs (void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr, const struct GNUNET_RECLAIM_Attestation *attest)
 
static void ticket_iter_err (void *cls)
 
static void ticket_iter_fin (void *cls)
 
static void ticket_iter (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
 
static void iter_error (void *cls)
 
static void timeout_task (void *cls)
 
static void process_rvk (void *cls, int success, const char *msg)
 
static void process_delete (void *cls, int success, const char *msg)
 
static void iter_finished (void *cls)
 
static void iter_cb (void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr)
 
static void attest_iter_finished (void *cls)
 
static void attest_iter_cb (void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, const struct GNUNET_RECLAIM_Attestation *attest)
 
static void start_process ()
 
static void ego_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name)
 
static void run (void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
 
int main (int argc, char *const argv[])
 

Variables

static int ret
 return value More...
 
static int list
 List attribute flag. More...
 
static int list_attestations
 List attestations flag. More...
 
static char * attestation_id
 Attestation ID string. More...
 
static struct GNUNET_RECLAIM_Identifier attestation
 Attestation ID. More...
 
static char * attestation_name
 Attestation name. More...
 
static int attestation_exists
 Attestation exists. More...
 
static char * rp
 Relying party. More...
 
static char * attr_name
 The attribute. More...
 
static char * attr_value
 Attribute value. More...
 
static char * issue_attrs
 Attributes to issue. More...
 
static char * consume_ticket
 Ticket to consume. More...
 
static char * type_str
 Attribute type. More...
 
static char * revoke_ticket
 Ticket to revoke. More...
 
static int list_tickets
 Ticket listing. More...
 
static char * ego_name
 Ego name. More...
 
static struct GNUNET_IDENTITY_Handleidentity_handle
 Identity handle. More...
 
static struct GNUNET_RECLAIM_Handlereclaim_handle
 reclaim handle More...
 
static struct GNUNET_RECLAIM_Operationreclaim_op
 reclaim operation More...
 
static struct GNUNET_RECLAIM_AttributeIteratorattr_iterator
 Attribute iterator. More...
 
static struct GNUNET_RECLAIM_AttestationIteratorattest_iterator
 Attestation iterator. More...
 
static struct GNUNET_RECLAIM_TicketIteratorticket_iterator
 Ticket iterator. More...
 
static struct GNUNET_CRYPTO_AbeMasterKeyabe_key
 Master ABE key. More...
 
static const struct GNUNET_CRYPTO_EcdsaPrivateKeypkey
 ego private key More...
 
static struct GNUNET_CRYPTO_EcdsaPublicKey rp_key
 rp public key More...
 
static struct GNUNET_RECLAIM_Ticket ticket
 Ticket to consume. More...
 
static struct GNUNET_RECLAIM_AttributeListattr_list
 Attribute list. More...
 
static struct GNUNET_TIME_Relative exp_interval
 Attribute expiration interval. More...
 
static struct GNUNET_SCHEDULER_Tasktimeout
 Timeout task. More...
 
static struct GNUNET_SCHEDULER_Taskcleanup_task
 Cleanup task. More...
 
struct GNUNET_RECLAIM_Attributeclaim
 Claim to store. More...
 
static char * attr_delete
 Claim to delete. More...
 
static struct GNUNET_RECLAIM_Attributeattr_to_delete
 Claim object to delete. More...
 
static int init = GNUNET_YES
 

Detailed Description

Identity Provider utility.

Author
Martin Schanzenbach

Definition in file gnunet-reclaim.c.

Function Documentation

◆ do_cleanup()

static void do_cleanup ( void *  cls)
static

Definition at line 202 of file gnunet-reclaim.c.

References GNUNET_free, GNUNET_IDENTITY_disconnect(), GNUNET_RECLAIM_cancel(), GNUNET_RECLAIM_disconnect(), GNUNET_RECLAIM_get_attestations_stop(), GNUNET_RECLAIM_get_attributes_stop(), GNUNET_RECLAIM_ticket_iteration_stop(), and GNUNET_SCHEDULER_cancel().

Referenced by attest_iter_finished(), iter_error(), iter_finished(), process_attrs(), process_delete(), process_rvk(), start_process(), store_cont(), ticket_issue_cb(), ticket_iter_err(), ticket_iter_fin(), and timeout_task().

203 {
204  cleanup_task = NULL;
205  if (NULL != timeout)
207  if (NULL != reclaim_op)
209  if (NULL != attr_iterator)
211  if (NULL != attest_iterator)
213  if (NULL != ticket_iterator)
215  if (NULL != reclaim_handle)
217  if (NULL != identity_handle)
219  if (NULL != abe_key)
221  if (NULL != attr_list)
223  if (NULL != attr_to_delete)
225 }
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
void GNUNET_RECLAIM_disconnect(struct GNUNET_RECLAIM_Handle *h)
Disconnect from identity provider service.
Definition: reclaim_api.c:1066
void GNUNET_RECLAIM_cancel(struct GNUNET_RECLAIM_Operation *op)
Cancel an identity provider operation.
Definition: reclaim_api.c:1051
void GNUNET_RECLAIM_ticket_iteration_stop(struct GNUNET_RECLAIM_TicketIterator *it)
Stops iteration and releases the handle for further calls.
Definition: reclaim_api.c:1661
static struct GNUNET_RECLAIM_AttestationIterator * attest_iterator
Attestation iterator.
static struct GNUNET_RECLAIM_Handle * reclaim_handle
reclaim handle
static struct GNUNET_RECLAIM_AttributeIterator * attr_iterator
Attribute iterator.
static struct GNUNET_RECLAIM_TicketIterator * ticket_iterator
Ticket iterator.
static struct GNUNET_RECLAIM_AttributeList * attr_list
Attribute list.
static struct GNUNET_SCHEDULER_Task * timeout
Timeout task.
static struct GNUNET_IDENTITY_Handle * identity_handle
Identity handle.
void GNUNET_IDENTITY_disconnect(struct GNUNET_IDENTITY_Handle *h)
Disconnect from identity service.
Definition: identity_api.c:837
static struct GNUNET_RECLAIM_Attribute * attr_to_delete
Claim object to delete.
static struct GNUNET_RECLAIM_Operation * reclaim_op
reclaim operation
void GNUNET_RECLAIM_get_attributes_stop(struct GNUNET_RECLAIM_AttributeIterator *it)
Stops iteration and releases the handle for further calls.
Definition: reclaim_api.c:1360
static struct GNUNET_CRYPTO_AbeMasterKey * abe_key
Master ABE key.
void GNUNET_RECLAIM_get_attestations_stop(struct GNUNET_RECLAIM_AttestationIterator *ait)
Stops iteration and releases the handle for further calls.
Definition: reclaim_api.c:1471
#define GNUNET_free(ptr)
Wrapper around free.
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:974
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ticket_issue_cb()

static void ticket_issue_cb ( void *  cls,
const struct GNUNET_RECLAIM_Ticket ticket 
)
static

Definition at line 229 of file gnunet-reclaim.c.

References do_cleanup(), GNUNET_free, GNUNET_SCHEDULER_add_now(), and GNUNET_STRINGS_data_to_string_alloc().

Referenced by iter_finished().

230 {
231  char *ticket_str;
232 
233  reclaim_op = NULL;
234  if (NULL != ticket)
235  {
236  ticket_str =
238  sizeof(
239  struct GNUNET_RECLAIM_Ticket));
240  printf ("%s\n", ticket_str);
241  GNUNET_free (ticket_str);
242  }
244 }
The authorization ticket.
static void do_cleanup(void *cls)
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
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.
Definition: scheduler.c:1298
static struct GNUNET_RECLAIM_Operation * reclaim_op
reclaim operation
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:923
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ store_cont()

static void store_cont ( void *  cls,
int32_t  success,
const char *  emsg 
)
static

Definition at line 248 of file gnunet-reclaim.c.

References do_cleanup(), GNUNET_SCHEDULER_add_now(), and GNUNET_SYSERR.

Referenced by attest_iter_finished(), and iter_finished().

249 {
250  reclaim_op = NULL;
251  if (GNUNET_SYSERR == success)
252  {
253  fprintf (stderr, "%s\n", emsg);
254  }
256 }
static void do_cleanup(void *cls)
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
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.
Definition: scheduler.c:1298
#define GNUNET_SYSERR
Definition: gnunet_common.h:84
static struct GNUNET_RECLAIM_Operation * reclaim_op
reclaim operation
Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_attrs()

static void process_attrs ( void *  cls,
const struct GNUNET_CRYPTO_EcdsaPublicKey identity,
const struct GNUNET_RECLAIM_Attribute attr,
const struct GNUNET_RECLAIM_Attestation attest 
)
static

Definition at line 260 of file gnunet-reclaim.c.

References GNUNET_RECLAIM_AttributeListEntry::attribute, data, GNUNET_RECLAIM_Attribute::data, GNUNET_RECLAIM_Attribute::data_size, data_size, do_cleanup(), GNUNET_RECLAIM_Attribute::flag, GNUNET_free, GNUNET_free_non_null, GNUNET_RECLAIM_attestation_get_attributes(), GNUNET_RECLAIM_attribute_number_to_typename(), GNUNET_RECLAIM_attribute_value_to_string(), GNUNET_SCHEDULER_add_now(), GNUNET_STRINGS_data_to_string_alloc(), GNUNET_RECLAIM_Attribute::id, id, GNUNET_RECLAIM_AttributeList::list_head, GNUNET_RECLAIM_Attribute::name, GNUNET_RECLAIM_AttributeListEntry::next, ret, and GNUNET_RECLAIM_Attribute::type.

Referenced by iter_finished().

264 {
265  char *value_str;
266  char *id;
267  const char *attr_type;
268 
269  if (NULL == identity)
270  {
271  reclaim_op = NULL;
273  return;
274  }
275  if (NULL == attr)
276  {
277  ret = 1;
278  return;
279  }
281  id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
282  value_str = NULL;
283  if (NULL == attest)
284  {
286  attr->data,
287  attr->data_size);
288  }
289  else
290  {
294 
295  for (ale = al->list_head; NULL != ale; ale = ale->next)
296  {
297  if (0 != strncmp (attr->data, ale->attribute->name, attr->data_size))
298  continue;
299  value_str
301  ale->attribute->
302  data,
303  ale->attribute->
304  data_size);
305  break;
306  }
307  }
308  fprintf (stdout,
309  "Name: %s; Value: %s (%s); Flag %u; ID: %s %s\n",
310  attr->name,
311  (NULL != value_str) ? value_str : "???",
312  attr_type,
313  attr->flag,
314  id,
315  (NULL == attest) ? "" : "(ATTESTED)");
316  GNUNET_free_non_null (value_str);
317  GNUNET_free (id);
318 }
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_attestation_get_attributes(const struct GNUNET_RECLAIM_Attestation *attest)
Convert an attestation type name to the corresponding number.
static void do_cleanup(void *cls)
const char * name
The name of the attribute.
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
A list of GNUNET_RECLAIM_Attribute structures.
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
#define GNUNET_free_non_null(ptr)
Free the memory pointed to by ptr if ptr is not NULL.
struct GNUNET_RECLAIM_Attribute * attribute
The attribute claim.
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.
Definition: scheduler.c:1298
struct GNUNET_RECLAIM_Identifier id
ID.
size_t data_size
Number of bytes in data.
struct GNUNET_RECLAIM_AttributeListEntry * next
DLL.
const char * GNUNET_RECLAIM_attribute_number_to_typename(uint32_t type)
Convert a type number to the corresponding type string.
static struct GNUNET_RECLAIM_Operation * reclaim_op
reclaim operation
const void * data
Binary value stored as attribute value.
char * GNUNET_RECLAIM_attribute_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the &#39;claim&#39; of an attribute to a string.
uint32_t type
Type of Claim.
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:923
static int ret
return value
uint32_t data
The data value.
struct GNUNET_RECLAIM_AttributeListEntry * list_head
List head.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ticket_iter_err()

static void ticket_iter_err ( void *  cls)
static

Definition at line 322 of file gnunet-reclaim.c.

References do_cleanup(), and GNUNET_SCHEDULER_add_now().

Referenced by start_process().

323 {
324  ticket_iterator = NULL;
325  fprintf (stderr, "Failed to iterate over tickets\n");
327 }
static void do_cleanup(void *cls)
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
static struct GNUNET_RECLAIM_TicketIterator * ticket_iterator
Ticket iterator.
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.
Definition: scheduler.c:1298
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ticket_iter_fin()

static void ticket_iter_fin ( void *  cls)
static

Definition at line 331 of file gnunet-reclaim.c.

References do_cleanup(), and GNUNET_SCHEDULER_add_now().

Referenced by start_process().

332 {
333  ticket_iterator = NULL;
335 }
static void do_cleanup(void *cls)
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
static struct GNUNET_RECLAIM_TicketIterator * ticket_iterator
Ticket iterator.
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.
Definition: scheduler.c:1298
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ticket_iter()

static void ticket_iter ( void *  cls,
const struct GNUNET_RECLAIM_Ticket ticket 
)
static

Definition at line 339 of file gnunet-reclaim.c.

References GNUNET_RECLAIM_Ticket::audience, GNUNET_free, GNUNET_RECLAIM_ticket_iteration_next(), GNUNET_STRINGS_data_to_string_alloc(), and GNUNET_RECLAIM_Ticket::rnd.

Referenced by start_process().

340 {
341  char *aud;
342  char *ref;
343  char *tkt;
344 
345  aud =
347  sizeof(struct
349  ref = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(ticket->rnd));
350  tkt =
352  sizeof(struct GNUNET_RECLAIM_Ticket));
353  fprintf (stdout, "Ticket: %s | ID: %s | Audience: %s\n", tkt, ref, aud);
354  GNUNET_free (aud);
355  GNUNET_free (ref);
356  GNUNET_free (tkt);
358 }
The authorization ticket.
void GNUNET_RECLAIM_ticket_iteration_next(struct GNUNET_RECLAIM_TicketIterator *it)
Calls the ticket processor specified in GNUNET_RECLAIM_ticket_iteration_start for the next record...
Definition: reclaim_api.c:1641
static struct GNUNET_RECLAIM_TicketIterator * ticket_iterator
Ticket iterator.
struct GNUNET_RECLAIM_Identifier rnd
The ticket random identifier.
struct GNUNET_CRYPTO_EcdsaPublicKey audience
The ticket audience (= relying party)
Public ECC key (always for Curve25519) encoded in a format suitable for network transmission and ECDS...
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:923
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ iter_error()

static void iter_error ( void *  cls)
static

Definition at line 362 of file gnunet-reclaim.c.

References do_cleanup(), and GNUNET_SCHEDULER_add_now().

Referenced by attest_iter_finished(), and start_process().

363 {
364  attr_iterator = NULL;
365  attest_iterator = NULL;
366  fprintf (stderr, "Failed\n");
367 
369 }
static void do_cleanup(void *cls)
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
static struct GNUNET_RECLAIM_AttestationIterator * attest_iterator
Attestation iterator.
static struct GNUNET_RECLAIM_AttributeIterator * attr_iterator
Attribute iterator.
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.
Definition: scheduler.c:1298
Here is the call graph for this function:
Here is the caller graph for this function:

◆ timeout_task()

static void timeout_task ( void *  cls)
static

Definition at line 373 of file gnunet-reclaim.c.

References do_cleanup(), GNUNET_SCHEDULER_add_now(), and ret.

Referenced by iter_finished().

374 {
375  timeout = NULL;
376  ret = 1;
377  fprintf (stderr, "Timeout\n");
378  if (NULL == cleanup_task)
380 }
static void do_cleanup(void *cls)
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
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.
Definition: scheduler.c:1298
static struct GNUNET_SCHEDULER_Task * timeout
Timeout task.
static int ret
return value
Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_rvk()

static void process_rvk ( void *  cls,
int  success,
const char *  msg 
)
static

Definition at line 384 of file gnunet-reclaim.c.

References do_cleanup(), GNUNET_OK, GNUNET_SCHEDULER_add_now(), and ret.

Referenced by iter_finished().

385 {
386  reclaim_op = NULL;
387  if (GNUNET_OK != success)
388  {
389  fprintf (stderr, "Revocation failed.\n");
390  ret = 1;
391  }
393 }
static void do_cleanup(void *cls)
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:83
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.
Definition: scheduler.c:1298
static struct GNUNET_RECLAIM_Operation * reclaim_op
reclaim operation
static int ret
return value
Here is the call graph for this function:
Here is the caller graph for this function:

◆ process_delete()

static void process_delete ( void *  cls,
int  success,
const char *  msg 
)
static

Definition at line 397 of file gnunet-reclaim.c.

References do_cleanup(), GNUNET_OK, GNUNET_SCHEDULER_add_now(), and ret.

Referenced by iter_finished().

398 {
399  reclaim_op = NULL;
400  if (GNUNET_OK != success)
401  {
402  fprintf (stderr, "Deletion failed.\n");
403  ret = 1;
404  }
406 }
static void do_cleanup(void *cls)
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:83
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.
Definition: scheduler.c:1298
static struct GNUNET_RECLAIM_Operation * reclaim_op
reclaim operation
static int ret
return value
Here is the call graph for this function:
Here is the caller graph for this function:

◆ iter_finished()

static void iter_finished ( void *  cls)
static

Definition at line 410 of file gnunet-reclaim.c.

References attestation, GNUNET_RECLAIM_Attribute::attestation, attestation_id, attr_delete, attr_name, attr_value, consume_ticket, data, GNUNET_RECLAIM_Attribute::data, GNUNET_RECLAIM_Attribute::data_size, data_size, do_cleanup(), exp_interval, GNUNET_assert, GNUNET_free, GNUNET_RECLAIM_attribute_delete(), GNUNET_RECLAIM_attribute_new(), GNUNET_RECLAIM_attribute_store(), GNUNET_RECLAIM_attribute_string_to_value(), GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING, GNUNET_RECLAIM_attribute_typename_to_number(), GNUNET_RECLAIM_ticket_consume(), GNUNET_RECLAIM_ticket_issue(), GNUNET_RECLAIM_ticket_revoke(), GNUNET_SCHEDULER_add_delayed(), GNUNET_SCHEDULER_add_now(), GNUNET_SYSERR, GNUNET_TIME_relative_multiply(), GNUNET_TIME_UNIT_SECONDS, issue_attrs, list, process_attrs(), process_delete(), process_rvk(), revoke_ticket, rp_key, store_cont(), ticket, ticket_issue_cb(), timeout_task(), GNUNET_RECLAIM_Attribute::type, type, and type_str.

Referenced by attest_iter_finished().

411 {
412  char *data;
413  size_t data_size;
414  int type;
415 
416  attr_iterator = NULL;
417  if (list)
418  {
420  return;
421  }
422 
423  if (issue_attrs)
424  {
426  pkey,
427  &rp_key,
428  attr_list,
430  NULL);
431  return;
432  }
433  if (consume_ticket)
434  {
436  pkey,
437  &ticket,
438  &process_attrs,
439  NULL);
442  &timeout_task,
443  NULL);
444  return;
445  }
446  if (revoke_ticket)
447  {
449  pkey,
450  &ticket,
451  &process_rvk,
452  NULL);
453  return;
454  }
455  if (attr_delete)
456  {
457  if (NULL == attr_to_delete)
458  {
459  fprintf (stdout, "No such attribute ``%s''\n", attr_delete);
460  return;
461  }
463  pkey,
466  NULL);
467  return;
468  }
469  if (attr_name)
470  {
471  if (NULL == type_str)
473  else
475 
478  attr_value,
479  (void **) &data,
480  &data_size));
481  if (NULL != claim)
482  {
483  claim->type = type;
484  claim->data = data;
486  }
487  else
488  {
489  claim =
490  GNUNET_RECLAIM_attribute_new (attr_name, NULL, type, data, data_size);
491  }
492  if (NULL != attestation_id)
493  {
495  }
497  pkey,
498  claim,
499  &exp_interval,
500  &store_cont,
501  NULL);
502  GNUNET_free (data);
503  GNUNET_free (claim);
504  return;
505  }
507 }
static char * consume_ticket
Ticket to consume.
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_ticket_consume(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, const struct GNUNET_RECLAIM_Ticket *ticket, GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls)
Consumes an issued ticket.
Definition: reclaim_api.c:1553
static void do_cleanup(void *cls)
static void store_cont(void *cls, int32_t success, const char *emsg)
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_attribute_delete(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, const struct GNUNET_RECLAIM_Attribute *attr, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
Delete an attribute.
Definition: reclaim_api.c:1144
struct GNUNET_RECLAIM_Attribute * claim
Claim to store.
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
static char * attr_delete
Claim to delete.
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_TIME_UNIT_SECONDS
One second.
static struct GNUNET_TIME_Relative exp_interval
Attribute expiration interval.
static struct GNUNET_RECLAIM_Handle * reclaim_handle
reclaim handle
static struct GNUNET_RECLAIM_AttributeIterator * attr_iterator
Attribute iterator.
struct GNUNET_RECLAIM_Identifier attestation
Referenced ID of Attestation (may be 0 if self-attested)
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
static struct GNUNET_RECLAIM_AttributeList * attr_list
Attribute list.
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.
Definition: scheduler.c:1271
static void ticket_issue_cb(void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_ticket_revoke(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, const struct GNUNET_RECLAIM_Ticket *ticket, GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls)
Revoked an issued ticket.
Definition: reclaim_api.c:1692
static char * attr_value
Attribute value.
static char * attr_name
The attribute.
#define GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING
String attribute.
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.
Definition: scheduler.c:1298
static struct GNUNET_SCHEDULER_Task * timeout
Timeout task.
uint32_t GNUNET_RECLAIM_attribute_typename_to_number(const char *typename)
Convert a type name to the corresponding number.
struct GNUNET_TIME_Relative GNUNET_TIME_relative_multiply(struct GNUNET_TIME_Relative rel, unsigned long long factor)
Multiply relative time by a given factor.
Definition: time.c:442
size_t data_size
Number of bytes in data.
static char * issue_attrs
Attributes to issue.
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_attribute_store(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, const struct GNUNET_RECLAIM_Attribute *attr, const struct GNUNET_TIME_Relative *exp_interval, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
Store an attribute.
Definition: reclaim_api.c:1097
static struct GNUNET_RECLAIM_Attribute * attr_to_delete
Claim object to delete.
int GNUNET_RECLAIM_attribute_string_to_value(uint32_t type, const char *s, void **data, size_t *data_size)
Convert human-readable version of a &#39;claim&#39; of an attribute to the binary representation.
static struct GNUNET_CRYPTO_EcdsaPublicKey rp_key
rp public key
#define GNUNET_SYSERR
Definition: gnunet_common.h:84
static char * type_str
Attribute type.
static void process_delete(void *cls, int success, const char *msg)
struct GNUNET_RECLAIM_Attribute * GNUNET_RECLAIM_attribute_new(const char *attr_name, const struct GNUNET_RECLAIM_Identifier *attestation, uint32_t type, const void *data, size_t data_size)
Create a new attribute claim.
static const struct GNUNET_CRYPTO_EcdsaPrivateKey * pkey
ego private key
static struct GNUNET_RECLAIM_Identifier attestation
Attestation ID.
static struct GNUNET_RECLAIM_Operation * reclaim_op
reclaim operation
static void process_rvk(void *cls, int success, const char *msg)
const void * data
Binary value stored as attribute value.
static char * attestation_id
Attestation ID string.
uint32_t type
Type of Claim.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model
static int list
List attribute flag.
static char * revoke_ticket
Ticket to revoke.
uint32_t data
The data value.
static void process_attrs(void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr, const struct GNUNET_RECLAIM_Attestation *attest)
static void timeout_task(void *cls)
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_ticket_issue(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *iss, const struct GNUNET_CRYPTO_EcdsaPublicKey *rp, const struct GNUNET_RECLAIM_AttributeList *attrs, GNUNET_RECLAIM_TicketCallback cb, void *cb_cls)
Issues a ticket to a relying party.
Definition: reclaim_api.c:1504
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ iter_cb()

static void iter_cb ( void *  cls,
const struct GNUNET_CRYPTO_EcdsaPublicKey identity,
const struct GNUNET_RECLAIM_Attribute attr 
)
static

Definition at line 511 of file gnunet-reclaim.c.

References GNUNET_RECLAIM_Attribute::attestation, attr_delete, attr_name, GNUNET_RECLAIM_AttributeListEntry::attribute, GNUNET_RECLAIM_Attribute::data, GNUNET_RECLAIM_Attribute::data_size, GNUNET_RECLAIM_Attribute::flag, GNUNET_CONTAINER_DLL_insert, GNUNET_free, GNUNET_new, GNUNET_RECLAIM_attribute_new(), GNUNET_RECLAIM_attribute_number_to_typename(), GNUNET_RECLAIM_attribute_value_to_string(), GNUNET_RECLAIM_get_attributes_next(), GNUNET_RECLAIM_id_is_zero, GNUNET_strdup, GNUNET_STRINGS_data_to_string_alloc(), GNUNET_YES, GNUNET_RECLAIM_Attribute::id, id, issue_attrs, list, GNUNET_RECLAIM_AttributeList::list_head, GNUNET_RECLAIM_AttributeList::list_tail, GNUNET_RECLAIM_Attribute::name, and GNUNET_RECLAIM_Attribute::type.

Referenced by attest_iter_finished().

514 {
516  char *attrs_tmp;
517  char *attr_str;
518  char *label;
519  char *id;
520  const char *attr_type;
521 
522  if ((NULL != attr_name) && (NULL != claim))
523  {
524  if (0 == strcasecmp (attr_name, attr->name))
525  {
527  &attr->attestation,
528  attr->type,
529  attr->data,
530  attr->data_size);
531  }
532  }
533  else if (issue_attrs)
534  {
535  attrs_tmp = GNUNET_strdup (issue_attrs);
536  attr_str = strtok (attrs_tmp, ",");
537  while (NULL != attr_str)
538  {
539  if (0 != strcasecmp (attr_str, attr->name))
540  {
541  attr_str = strtok (NULL, ",");
542  continue;
543  }
546  &attr->attestation,
547  attr->type,
548  attr->data,
549  attr->data_size);
550  le->attribute->flag = attr->flag;
551  le->attribute->id = attr->id;
554  le);
555  break;
556  }
557  GNUNET_free (attrs_tmp);
558  }
559  else if (attr_delete && (NULL == attr_to_delete))
560  {
561  label = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
562  if (0 == strcasecmp (attr_delete, label))
563  {
565  &attr->attestation,
566  attr->type,
567  attr->data,
568  attr->data_size);
569  attr_to_delete->id = attr->id;
570  }
571  GNUNET_free (label);
572  }
573  else if (list)
574  {
576  attr->data,
577  attr->data_size);
579  id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
581  {
582  fprintf (stdout,
583  "%s: ``%s'' (%s); ID: %s\n",
584  attr->name,
585  attr_str,
586  attr_type,
587  id);
588  }
589  else
590  {
591  char *attest_id =
593  sizeof(attr->attestation));
594  fprintf (stdout,
595  "%s: <``%s'' in attestation %s> (%s); ID: %s\n",
596  attr->name,
597  attr_str,
598  attest_id,
599  attr_type,
600  id);
601  GNUNET_free (attest_id);
602 
603  }
604  GNUNET_free (id);
605  }
607 }
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
struct GNUNET_RECLAIM_Attribute * claim
Claim to store.
const char * name
The name of the attribute.
static char * attr_delete
Claim to delete.
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
void GNUNET_RECLAIM_get_attributes_next(struct GNUNET_RECLAIM_AttributeIterator *it)
Calls the record processor specified in GNUNET_RECLAIM_get_attributes_start for the next record...
Definition: reclaim_api.c:1339
static struct GNUNET_RECLAIM_AttributeIterator * attr_iterator
Attribute iterator.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
struct GNUNET_RECLAIM_Attribute * attribute
The attribute claim.
struct GNUNET_RECLAIM_Identifier attestation
Referenced ID of Attestation (may be 0 if self-attested)
static struct GNUNET_RECLAIM_AttributeList * attr_list
Attribute list.
static char * attr_name
The attribute.
struct GNUNET_RECLAIM_AttributeListEntry * list_tail
List tail.
struct GNUNET_RECLAIM_Identifier id
ID.
size_t data_size
Number of bytes in data.
static char * issue_attrs
Attributes to issue.
static struct GNUNET_RECLAIM_Attribute * attr_to_delete
Claim object to delete.
struct GNUNET_RECLAIM_Attribute * GNUNET_RECLAIM_attribute_new(const char *attr_name, const struct GNUNET_RECLAIM_Identifier *attestation, uint32_t type, const void *data, size_t data_size)
Create a new attribute claim.
const char * GNUNET_RECLAIM_attribute_number_to_typename(uint32_t type)
Convert a type number to the corresponding type string.
const void * data
Binary value stored as attribute value.
char * GNUNET_RECLAIM_attribute_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the &#39;claim&#39; of an attribute to a string.
uint32_t type
Type of Claim.
#define GNUNET_YES
Definition: gnunet_common.h:85
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:923
static int list
List attribute flag.
struct GNUNET_RECLAIM_AttributeListEntry * list_head
List head.
#define GNUNET_free(ptr)
Wrapper around free.
#define GNUNET_RECLAIM_id_is_zero(a)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ attest_iter_finished()

static void attest_iter_finished ( void *  cls)
static

Definition at line 611 of file gnunet-reclaim.c.

References attestation, attestation_name, attr_value, do_cleanup(), exp_interval, GNUNET_RECLAIM_attestation_new(), GNUNET_RECLAIM_attestation_store(), GNUNET_RECLAIM_ATTESTATION_TYPE_JWT, GNUNET_RECLAIM_get_attributes_start(), GNUNET_SCHEDULER_add_now(), iter_cb(), iter_error(), iter_finished(), list_attestations, and store_cont().

Referenced by start_process().

612 {
613  attest_iterator = NULL;
614 
615  // Add new attestation
616  if ((NULL != attestation_name) &&
617  (NULL != attr_value))
618  {
621  GNUNET_RECLAIM_ATTESTATION_TYPE_JWT, // FIXME hardcoded
622  attr_value,
623  strlen (attr_value));
625  pkey,
626  attestation,
627  &exp_interval,
628  store_cont,
629  NULL);
630  return;
631 
632  }
633  if (list_attestations)
634  {
636  return;
637  }
639  pkey,
640  &iter_error,
641  NULL,
642  &iter_cb,
643  NULL,
644  &iter_finished,
645  NULL);
646 
647 }
struct GNUNET_RECLAIM_AttributeIterator * GNUNET_RECLAIM_get_attributes_start(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_RECLAIM_AttributeResult proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
List all attributes for a local identity.
Definition: reclaim_api.c:1293
static void do_cleanup(void *cls)
static void iter_finished(void *cls)
static void store_cont(void *cls, int32_t success, const char *emsg)
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
static void iter_cb(void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr)
static struct GNUNET_RECLAIM_AttestationIterator * attest_iterator
Attestation iterator.
static struct GNUNET_TIME_Relative exp_interval
Attribute expiration interval.
static struct GNUNET_RECLAIM_Handle * reclaim_handle
reclaim handle
static struct GNUNET_RECLAIM_AttributeIterator * attr_iterator
Attribute iterator.
static char * attr_value
Attribute value.
static char * attestation_name
Attestation name.
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.
Definition: scheduler.c:1298
struct GNUNET_RECLAIM_Attestation * GNUNET_RECLAIM_attestation_new(const char *name, uint32_t type, const void *data, size_t data_size)
Create a new attestation.
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_attestation_store(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *pkey, const struct GNUNET_RECLAIM_Attestation *attestation, const struct GNUNET_TIME_Relative *exp_interval, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
Store an attestation.
Definition: reclaim_api.c:1189
static void iter_error(void *cls)
#define GNUNET_RECLAIM_ATTESTATION_TYPE_JWT
A JSON Web Token attestation.
static const struct GNUNET_CRYPTO_EcdsaPrivateKey * pkey
ego private key
static struct GNUNET_RECLAIM_Identifier attestation
Attestation ID.
static struct GNUNET_RECLAIM_Operation * reclaim_op
reclaim operation
static int list_attestations
List attestations flag.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ attest_iter_cb()

static void attest_iter_cb ( void *  cls,
const struct GNUNET_CRYPTO_EcdsaPublicKey identity,
const struct GNUNET_RECLAIM_Attestation attest 
)
static

Definition at line 651 of file gnunet-reclaim.c.

References attestation, attestation_exists, GNUNET_RECLAIM_AttributeListEntry::attribute, data, GNUNET_RECLAIM_Attestation::data, GNUNET_RECLAIM_Attestation::data_size, data_size, GNUNET_free, GNUNET_RECLAIM_attestation_get_attributes(), GNUNET_RECLAIM_attestation_number_to_typename(), GNUNET_RECLAIM_attestation_value_to_string(), GNUNET_RECLAIM_attribute_list_destroy(), GNUNET_RECLAIM_attribute_value_to_string(), GNUNET_RECLAIM_get_attestations_next(), GNUNET_RECLAIM_id_is_equal, GNUNET_STRINGS_data_to_string_alloc(), GNUNET_YES, GNUNET_RECLAIM_Attestation::id, id, list_attestations, GNUNET_RECLAIM_AttributeList::list_head, GNUNET_RECLAIM_Attribute::name, GNUNET_RECLAIM_Attestation::name, GNUNET_RECLAIM_AttributeListEntry::next, GNUNET_RECLAIM_Attribute::type, and GNUNET_RECLAIM_Attestation::type.

Referenced by start_process().

654 {
655  char *attest_str;
656  char *attr_str;
657  char *id;
658  const char *attest_type;
660 
662  &attest->id))
664  if (list_attestations)
665  {
666  attest_str = GNUNET_RECLAIM_attestation_value_to_string (attest->type,
667  attest->data,
668  attest->data_size);
669  attest_type = GNUNET_RECLAIM_attestation_number_to_typename (attest->type);
670  id = GNUNET_STRINGS_data_to_string_alloc (&attest->id, sizeof(attest->id));
671  fprintf (stdout,
672  "%s: ``%s'' (%s); ID: %s\n",
673  attest->name,
674  attest_str,
675  attest_type,
676  id);
677  struct GNUNET_RECLAIM_AttributeList *attrs =
679  if (NULL != attrs)
680  {
681  fprintf (stdout,
682  "\t Attributes:\n");
683  for (ale = attrs->list_head; NULL != ale; ale = ale->next)
684  {
686  ale->attribute->type,
687  ale->attribute->
688  data,
689  ale->attribute->
690  data_size);
691 
692  fprintf (stdout,
693  "\t %s: %s\n", ale->attribute->name, attr_str);
694  GNUNET_free (attr_str);
695  }
697  }
698  GNUNET_free (id);
699  }
701 }
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_attestation_get_attributes(const struct GNUNET_RECLAIM_Attestation *attest)
Convert an attestation type name to the corresponding number.
void GNUNET_RECLAIM_attribute_list_destroy(struct GNUNET_RECLAIM_AttributeList *attrs)
Destroy claim list.
const char * name
The name of the attribute.
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
A list of GNUNET_RECLAIM_Attribute structures.
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
static struct GNUNET_RECLAIM_AttestationIterator * attest_iterator
Attestation iterator.
void GNUNET_RECLAIM_get_attestations_next(struct GNUNET_RECLAIM_AttestationIterator *ait)
Calls the record processor specified in #GNUNET_RECLAIM_get_attestation_start for the next record...
Definition: reclaim_api.c:1449
struct GNUNET_RECLAIM_Attribute * attribute
The attribute claim.
char * GNUNET_RECLAIM_attestation_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the &#39;claim&#39; of an attestation to a string.
const char * GNUNET_RECLAIM_attestation_number_to_typename(uint32_t type)
Convert an attestation type number to the corresponding attestation type string.
size_t data_size
Number of bytes in data.
const char * name
The name of the attribute.
struct GNUNET_RECLAIM_Identifier id
ID.
uint32_t type
Type/Format of Claim.
struct GNUNET_RECLAIM_AttributeListEntry * next
DLL.
const void * data
Binary value stored as attribute value.
static struct GNUNET_RECLAIM_Identifier attestation
Attestation ID.
static int list_attestations
List attestations flag.
#define GNUNET_RECLAIM_id_is_equal(a, b)
char * GNUNET_RECLAIM_attribute_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the &#39;claim&#39; of an attribute to a string.
uint32_t type
Type of Claim.
#define GNUNET_YES
Definition: gnunet_common.h:85
static int attestation_exists
Attestation exists.
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:923
uint32_t data
The data value.
struct GNUNET_RECLAIM_AttributeListEntry * list_head
List head.
#define GNUNET_free(ptr)
Wrapper around free.
Here is the call graph for this function:
Here is the caller graph for this function:

◆ start_process()

static void start_process ( )
static

Definition at line 705 of file gnunet-reclaim.c.

References attest_iter_cb(), attest_iter_finished(), attestation, attestation_exists, attestation_id, consume_ticket, do_cleanup(), ego_name, GNUNET_CRYPTO_ecdsa_public_key_from_string(), GNUNET_new, GNUNET_NO, GNUNET_OK, GNUNET_RECLAIM_get_attestations_start(), GNUNET_RECLAIM_ID_ZERO, GNUNET_RECLAIM_ticket_iteration_start(), GNUNET_SCHEDULER_add_now(), GNUNET_STRINGS_string_to_data(), iter_error(), list_tickets, revoke_ticket, rp, rp_key, ticket, ticket_iter(), ticket_iter_err(), and ticket_iter_fin().

Referenced by ego_cb().

706 {
707  if (NULL == pkey)
708  {
709  fprintf (stderr, "Ego %s not found\n", ego_name);
711  return;
712  }
714  if (NULL != attestation_id)
716  strlen (attestation_id),
717  &attestation, sizeof(attestation));
719  if (list_tickets)
720  {
722  pkey,
724  NULL,
725  &ticket_iter,
726  NULL,
728  NULL);
729  return;
730  }
731 
732  if ((NULL != rp) &&
733  (GNUNET_OK !=
735  {
736  fprintf (stderr, "%s is not a public key!\n", rp);
738  return;
739  }
740  if (NULL != consume_ticket)
742  strlen (consume_ticket),
743  &ticket,
744  sizeof(struct GNUNET_RECLAIM_Ticket));
745  if (NULL != revoke_ticket)
747  strlen (revoke_ticket),
748  &ticket,
749  sizeof(struct GNUNET_RECLAIM_Ticket));
750 
752  claim = NULL;
754  pkey,
755  &iter_error,
756  NULL,
758  NULL,
759  &
761  NULL);
762 
763 }
static char * consume_ticket
Ticket to consume.
The authorization ticket.
struct GNUNET_RECLAIM_AttestationIterator * GNUNET_RECLAIM_get_attestations_start(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_RECLAIM_AttestationResult proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
List all attestations for a local identity.
Definition: reclaim_api.c:1402
static void do_cleanup(void *cls)
static void ticket_iter_fin(void *cls)
struct GNUNET_RECLAIM_TicketIterator * GNUNET_RECLAIM_ticket_iteration_start(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_EcdsaPrivateKey *identity, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_RECLAIM_TicketCallback proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
Lists all tickets that have been issued to remote identites (relying parties)
Definition: reclaim_api.c:1597
static int list_tickets
Ticket listing.
struct GNUNET_RECLAIM_Attribute * claim
Claim to store.
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
#define GNUNET_NO
Definition: gnunet_common.h:86
A list of GNUNET_RECLAIM_Attribute structures.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:83
#define GNUNET_new(type)
Allocate a struct or union of the given type.
static struct GNUNET_RECLAIM_AttestationIterator * attest_iterator
Attestation iterator.
static struct GNUNET_RECLAIM_Handle * reclaim_handle
reclaim handle
static struct GNUNET_RECLAIM_TicketIterator * ticket_iterator
Ticket iterator.
static void attest_iter_finished(void *cls)
static char * ego_name
Ego name.
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
static struct GNUNET_RECLAIM_AttributeList * attr_list
Attribute list.
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.
Definition: scheduler.c:1298
static const struct GNUNET_RECLAIM_Identifier GNUNET_RECLAIM_ID_ZERO
static void attest_iter_cb(void *cls, const struct GNUNET_CRYPTO_EcdsaPublicKey *identity, const struct GNUNET_RECLAIM_Attestation *attest)
static struct GNUNET_CRYPTO_EcdsaPublicKey rp_key
rp public key
static void iter_error(void *cls)
static void ticket_iter(void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
static void ticket_iter_err(void *cls)
static const struct GNUNET_CRYPTO_EcdsaPrivateKey * pkey
ego private key
static struct GNUNET_RECLAIM_Identifier attestation
Attestation ID.
int GNUNET_CRYPTO_ecdsa_public_key_from_string(const char *enc, size_t enclen, struct GNUNET_CRYPTO_EcdsaPublicKey *pub)
Convert a string representing a public key to a public key.
Definition: crypto_ecc.c:357
static char * attestation_id
Attestation ID string.
static char * rp
Relying party.
static int attestation_exists
Attestation exists.
static char * revoke_ticket
Ticket to revoke.
int GNUNET_STRINGS_string_to_data(const char *enc, size_t enclen, void *out, size_t out_size)
Convert CrockfordBase32 encoding back to data.
Definition: strings.c:955
Here is the call graph for this function:
Here is the caller graph for this function:

◆ ego_cb()

static void ego_cb ( void *  cls,
struct GNUNET_IDENTITY_Ego ego,
void **  ctx,
const char *  name 
)
static

Definition at line 769 of file gnunet-reclaim.c.

References ego_name, GNUNET_IDENTITY_ego_get_private_key(), GNUNET_NO, GNUNET_YES, init, and start_process().

Referenced by run().

773 {
774  if (NULL == name)
775  {
776  if (GNUNET_YES == init)
777  {
778  init = GNUNET_NO;
779  start_process ();
780  }
781  return;
782  }
783  if (0 != strcmp (name, ego_name))
784  return;
786 }
static int init
const struct GNUNET_CRYPTO_EcdsaPrivateKey * GNUNET_IDENTITY_ego_get_private_key(const struct GNUNET_IDENTITY_Ego *ego)
Obtain the ECC key associated with a ego.
Definition: identity_api.c:555
#define GNUNET_NO
Definition: gnunet_common.h:86
static void start_process()
static char * ego_name
Ego name.
static const struct GNUNET_CRYPTO_EcdsaPrivateKey * pkey
ego private key
const char * name
#define GNUNET_YES
Definition: gnunet_common.h:85
Here is the call graph for this function:
Here is the caller graph for this function:

◆ run()

static void run ( void *  cls,
char *const *  args,
const char *  cfgfile,
const struct GNUNET_CONFIGURATION_Handle c 
)
static

Definition at line 790 of file gnunet-reclaim.c.

References _, attr_name, attr_value, ego_cb(), ego_name, GNUNET_IDENTITY_connect(), GNUNET_RECLAIM_connect(), issue_attrs, ret, and rp.

Referenced by main().

794 {
795  ret = 0;
796  if (NULL == ego_name)
797  {
798  ret = 1;
799  fprintf (stderr, _ ("Ego is required\n"));
800  return;
801  }
802 
803  if ((NULL == attr_value) && (NULL != attr_name))
804  {
805  ret = 1;
806  fprintf (stderr, _ ("Attribute value missing!\n"));
807  return;
808  }
809 
810  if ((NULL == rp) && (NULL != issue_attrs))
811  {
812  ret = 1;
813  fprintf (stderr, _ ("Requesting party key is required!\n"));
814  return;
815  }
816 
818  // Get Ego
820 }
struct GNUNET_IDENTITY_Handle * GNUNET_IDENTITY_connect(const struct GNUNET_CONFIGURATION_Handle *cfg, GNUNET_IDENTITY_Callback cb, void *cb_cls)
Connect to the identity service.
Definition: identity_api.c:527
static struct GNUNET_RECLAIM_Handle * reclaim_handle
reclaim handle
#define _(String)
GNU gettext support macro.
Definition: platform.h:180
static char * ego_name
Ego name.
static char * attr_value
Attribute value.
static char * attr_name
The attribute.
static struct GNUNET_IDENTITY_Handle * identity_handle
Identity handle.
static char * issue_attrs
Attributes to issue.
static void ego_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name)
static char * rp
Relying party.
static int ret
return value
struct GNUNET_RECLAIM_Handle * GNUNET_RECLAIM_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the re:claimID service.
Definition: reclaim_api.c:1026
Here is the call graph for this function:
Here is the caller graph for this function:

◆ main()

int main ( int  argc,
char *const  argv[] 
)

Definition at line 824 of file gnunet-reclaim.c.

References _, attestation_id, attestation_name, attr_delete, attr_name, attr_value, consume_ticket, ego_name, exp_interval, gettext_noop, GNUNET_GETOPT_OPTION_END, GNUNET_GETOPT_option_flag(), GNUNET_GETOPT_option_relative_time(), GNUNET_GETOPT_option_string(), GNUNET_OK, GNUNET_PROGRAM_run(), GNUNET_TIME_UNIT_HOURS, issue_attrs, list, list_attestations, list_tickets, ret, revoke_ticket, rp, run(), and type_str.

825 {
829  "add",
830  "NAME",
831  gettext_noop ("Add an attribute NAME"),
832  &attr_name),
834  "delete",
835  "ID",
836  gettext_noop ("Delete the attribute with ID"),
837  &attr_delete),
839  "value",
840  "VALUE",
841  gettext_noop ("The attribute VALUE"),
842  &attr_value),
844  "ego",
845  "EGO",
846  gettext_noop ("The EGO to use"),
847  &ego_name),
849  "rp",
850  "RP",
851  gettext_noop (
852  "Specify the relying party for issue"),
853  &rp),
855  "dump",
856  gettext_noop ("List attributes for EGO"),
857  &list),
859  "attestations",
860  gettext_noop ("List attestations for EGO"),
863  "Attestation ID",
864  "ATTESTATION_ID",
865  gettext_noop (
866  "Attestation to use for attribute"),
867  &attestation_id),
869  "attestation-name",
870  "NAME",
871  gettext_noop ("Attestation name"),
874  "issue",
875  "A1,A2,...",
876  gettext_noop (
877  "Issue a ticket for a set of attributes separated by comma"),
878  &issue_attrs),
880  "consume",
881  "TICKET",
882  gettext_noop ("Consume a ticket"),
883  &consume_ticket),
885  "revoke",
886  "TICKET",
887  gettext_noop ("Revoke a ticket"),
888  &revoke_ticket),
890  "type",
891  "TYPE",
892  gettext_noop ("Type of attribute"),
893  &type_str),
895  "tickets",
896  gettext_noop ("List tickets of ego"),
897  &list_tickets),
899  "expiration",
900  "INTERVAL",
901  gettext_noop (
902  "Expiration interval of the attribute"),
903  &exp_interval),
904 
906  };
907  if (GNUNET_OK != GNUNET_PROGRAM_run (argc,
908  argv,
909  "gnunet-reclaim",
910  _ ("re:claimID command line tool"),
911  options,
912  &run,
913  NULL))
914  return 1;
915  else
916  return ret;
917 }
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_option_relative_time(char shortName, const char *name, const char *argumentHelp, const char *description, struct GNUNET_TIME_Relative *val)
Allow user to specify a struct GNUNET_TIME_Relative (using human-readable "fancy" time)...
static char * consume_ticket
Ticket to consume.
#define GNUNET_TIME_UNIT_HOURS
One hour.
static int list_tickets
Ticket listing.
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
static char * attr_delete
Claim to delete.
#define GNUNET_OK
Named constants for return values.
Definition: gnunet_common.h:83
Definition of a command line option.
static struct GNUNET_TIME_Relative exp_interval
Attribute expiration interval.
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
Definition: 002.c:13
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.
#define _(String)
GNU gettext support macro.
Definition: platform.h:180
static char * ego_name
Ego name.
static char * attr_value
Attribute value.
static char * attr_name
The attribute.
static char * attestation_name
Attestation name.
static char * issue_attrs
Attributes to issue.
static char * type_str
Attribute type.
static int list_attestations
List attestations flag.
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.
static char * attestation_id
Attestation ID string.
static char * rp
Relying party.
int GNUNET_PROGRAM_run(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, parse options).
Definition: program.c:367
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
static int list
List attribute flag.
static char * revoke_ticket
Ticket to revoke.
static int ret
return value
#define gettext_noop(String)
Definition: gettext.h:69
Here is the call graph for this function:

Variable Documentation

◆ ret

int ret
static

return value

Definition at line 38 of file gnunet-reclaim.c.

Referenced by main(), process_attrs(), process_delete(), process_rvk(), run(), and timeout_task().

◆ list

int list
static

List attribute flag.

Definition at line 43 of file gnunet-reclaim.c.

Referenced by iter_cb(), iter_finished(), and main().

◆ list_attestations

int list_attestations
static

List attestations flag.

Definition at line 48 of file gnunet-reclaim.c.

Referenced by attest_iter_cb(), attest_iter_finished(), and main().

◆ attestation_id

char* attestation_id
static

Attestation ID string.

Definition at line 53 of file gnunet-reclaim.c.

Referenced by iter_finished(), main(), and start_process().

◆ attestation

struct GNUNET_RECLAIM_Identifier attestation
static

◆ attestation_name

char* attestation_name
static

Attestation name.

Definition at line 63 of file gnunet-reclaim.c.

Referenced by attest_iter_finished(), and main().

◆ attestation_exists

int attestation_exists
static

Attestation exists.

Definition at line 68 of file gnunet-reclaim.c.

Referenced by attest_iter_cb(), and start_process().

◆ rp

char* rp
static

◆ attr_name

char* attr_name
static

The attribute.

Definition at line 78 of file gnunet-reclaim.c.

Referenced by iter_cb(), iter_finished(), main(), and run().

◆ attr_value

char* attr_value
static

Attribute value.

Definition at line 83 of file gnunet-reclaim.c.

Referenced by attest_iter_finished(), iter_finished(), main(), and run().

◆ issue_attrs

char* issue_attrs
static

Attributes to issue.

Definition at line 88 of file gnunet-reclaim.c.

Referenced by iter_cb(), iter_finished(), main(), and run().

◆ consume_ticket

char* consume_ticket
static

Ticket to consume.

Definition at line 93 of file gnunet-reclaim.c.

Referenced by iter_finished(), main(), and start_process().

◆ type_str

char* type_str
static

Attribute type.

Definition at line 98 of file gnunet-reclaim.c.

Referenced by iter_finished(), main(), parse_attest(), parse_attr(), and parse_jwt().

◆ revoke_ticket

char* revoke_ticket
static

Ticket to revoke.

Definition at line 103 of file gnunet-reclaim.c.

Referenced by iter_finished(), main(), and start_process().

◆ list_tickets

int list_tickets
static

Ticket listing.

Definition at line 108 of file gnunet-reclaim.c.

Referenced by main(), and start_process().

◆ ego_name

char* ego_name
static

Ego name.

Definition at line 113 of file gnunet-reclaim.c.

Referenced by ego_cb(), main(), run(), and start_process().

◆ identity_handle

struct GNUNET_IDENTITY_Handle* identity_handle
static

Identity handle.

Definition at line 118 of file gnunet-reclaim.c.

◆ reclaim_handle

struct GNUNET_RECLAIM_Handle* reclaim_handle
static

reclaim handle

Definition at line 123 of file gnunet-reclaim.c.

◆ reclaim_op

struct GNUNET_RECLAIM_Operation* reclaim_op
static

reclaim operation

Definition at line 128 of file gnunet-reclaim.c.

◆ attr_iterator

struct GNUNET_RECLAIM_AttributeIterator* attr_iterator
static

Attribute iterator.

Definition at line 133 of file gnunet-reclaim.c.

◆ attest_iterator

struct GNUNET_RECLAIM_AttestationIterator* attest_iterator
static

Attestation iterator.

Definition at line 138 of file gnunet-reclaim.c.

◆ ticket_iterator

struct GNUNET_RECLAIM_TicketIterator* ticket_iterator
static

Ticket iterator.

Definition at line 144 of file gnunet-reclaim.c.

◆ abe_key

struct GNUNET_CRYPTO_AbeMasterKey* abe_key
static

Master ABE key.

Definition at line 149 of file gnunet-reclaim.c.

◆ pkey

const struct GNUNET_CRYPTO_EcdsaPrivateKey* pkey
static

ego private key

Definition at line 154 of file gnunet-reclaim.c.

◆ rp_key

struct GNUNET_CRYPTO_EcdsaPublicKey rp_key
static

rp public key

Definition at line 159 of file gnunet-reclaim.c.

Referenced by iter_finished(), and start_process().

◆ ticket

struct GNUNET_RECLAIM_Ticket ticket
static

◆ attr_list

struct GNUNET_RECLAIM_AttributeList* attr_list
static

Attribute list.

Definition at line 169 of file gnunet-reclaim.c.

◆ exp_interval

struct GNUNET_TIME_Relative exp_interval
static

Attribute expiration interval.

Definition at line 174 of file gnunet-reclaim.c.

Referenced by attest_iter_finished(), iter_finished(), and main().

◆ timeout

struct GNUNET_SCHEDULER_Task* timeout
static

Timeout task.

Definition at line 179 of file gnunet-reclaim.c.

◆ cleanup_task

struct GNUNET_SCHEDULER_Task* cleanup_task
static

Cleanup task.

Definition at line 184 of file gnunet-reclaim.c.

Referenced by GST_neighbour_get_connection_cancel().

◆ claim

struct GNUNET_RECLAIM_Attribute* claim

Claim to store.

Definition at line 189 of file gnunet-reclaim.c.

Referenced by rvk_move_attr_cb().

◆ attr_delete

char* attr_delete
static

Claim to delete.

Definition at line 194 of file gnunet-reclaim.c.

Referenced by iter_cb(), iter_finished(), and main().

◆ attr_to_delete

struct GNUNET_RECLAIM_Attribute* attr_to_delete
static

Claim object to delete.

Definition at line 199 of file gnunet-reclaim.c.

◆ init

int init = GNUNET_YES
static

Definition at line 766 of file gnunet-reclaim.c.

Referenced by ego_cb().