GNUnet  0.11.x
gnunet-reclaim.c
Go to the documentation of this file.
1 /*
2  This file is part of GNUnet.
3  Copyright (C) 2012-2015 GNUnet e.V.
4 
5  GNUnet is free software: you can redistribute it and/or modify it
6  under the terms of the GNU Affero General Public License as published
7  by the Free Software Foundation, either version 3 of the License,
8  or (at your option) any later version.
9 
10  GNUnet is distributed in the hope that it will be useful, but
11  WITHOUT ANY WARRANTY; without even the implied warranty of
12  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13  Affero General Public License for more details.
14 
15  You should have received a copy of the GNU Affero General Public License
16  along with this program. If not, see <http://www.gnu.org/licenses/>.
17 
18  SPDX-License-Identifier: AGPL3.0-or-later
19  */
26 #include "platform.h"
27 #include <inttypes.h>
28 
29 #include "gnunet_util_lib.h"
30 
33 #include "gnunet_reclaim_service.h"
34 #include "gnunet_signatures.h"
38 static int ret;
39 
43 static int list;
44 
48 static int list_credentials;
49 
53 static char *credential_id;
54 
59 
63 static char *credential_name;
64 
68 static char *credential_type;
69 
73 static int credential_exists;
74 
78 static char *rp;
79 
83 static char *attr_name;
84 
88 static char *attr_value;
89 
93 static char *issue_attrs;
94 
98 static char *consume_ticket;
99 
103 static char *type_str;
104 
108 static char *revoke_ticket;
109 
113 static int list_tickets;
114 
118 static char *ego_name;
119 
124 
129 
134 
139 
144 
145 
150 
151 
155 static const struct GNUNET_IDENTITY_PrivateKey *pkey;
156 
160 static struct GNUNET_IDENTITY_PublicKey rp_key;
161 
165 static struct GNUNET_RECLAIM_Ticket ticket;
166 
171 
175 static struct GNUNET_TIME_Relative exp_interval;
176 
181 
186 
191 
195 static char *attr_delete;
196 
201 
202 static void
203 do_cleanup (void *cls)
204 {
205  cleanup_task = NULL;
206  if (NULL != timeout)
208  if (NULL != reclaim_op)
210  if (NULL != attr_iterator)
212  if (NULL != cred_iterator)
214  if (NULL != ticket_iterator)
216  if (NULL != reclaim_handle)
218  if (NULL != identity_handle)
220  if (NULL != attr_list)
222  if (NULL != attr_to_delete)
224  if (NULL == credential_type)
226 }
227 
228 
229 static void
230 ticket_issue_cb (void *cls,
231  const struct GNUNET_RECLAIM_Ticket *ticket,
232  const struct GNUNET_RECLAIM_PresentationList *presentations)
233 {
234  char *ticket_str;
235 
236  reclaim_op = NULL;
237  if (NULL != ticket)
238  {
239  ticket_str =
241  sizeof(
242  struct GNUNET_RECLAIM_Ticket));
243  printf ("%s\n", ticket_str);
244  GNUNET_free (ticket_str);
245  }
247 }
248 
249 
250 static void
251 store_cont (void *cls, int32_t success, const char *emsg)
252 {
253  reclaim_op = NULL;
254  if (GNUNET_SYSERR == success)
255  {
256  fprintf (stderr, "%s\n", emsg);
257  }
259 }
260 
261 
262 static void
263 process_attrs (void *cls,
264  const struct GNUNET_IDENTITY_PublicKey *identity,
265  const struct GNUNET_RECLAIM_Attribute *attr,
266  const struct GNUNET_RECLAIM_Presentation *presentation)
267 {
268  char *value_str;
269  char *id;
270  const char *attr_type;
271 
272  if (NULL == identity)
273  {
274  reclaim_op = NULL;
276  return;
277  }
278  if (NULL == attr)
279  {
280  ret = 1;
281  return;
282  }
284  id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
285  value_str = NULL;
286  if (NULL == presentation)
287  {
289  attr->data,
290  attr->data_size);
291  }
292  else
293  {
297 
298  for (ale = al->list_head; NULL != ale; ale = ale->next)
299  {
300  if (0 != strncmp (attr->data, ale->attribute->name, attr->data_size))
301  continue;
302  value_str
304  ale->attribute->data,
305  ale->attribute->data_size);
306  break;
307  }
308  }
309  fprintf (stdout,
310  "Name: %s; Value: %s (%s); Flag %u; ID: %s %s\n",
311  attr->name,
312  (NULL != value_str) ? value_str : "???",
313  attr_type,
314  attr->flag,
315  id,
316  (NULL == presentation) ? "" : "(ATTESTED)");
317  GNUNET_free (value_str);
318  GNUNET_free (id);
319 }
320 
321 
322 static void
323 ticket_iter_err (void *cls)
324 {
325  ticket_iterator = NULL;
326  fprintf (stderr, "Failed to iterate over tickets\n");
328 }
329 
330 
331 static void
332 ticket_iter_fin (void *cls)
333 {
334  ticket_iterator = NULL;
336 }
337 
338 
339 static void
340 ticket_iter (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
341 {
342  char *aud;
343  char *ref;
344  char *tkt;
345 
346  aud =
348  sizeof(struct
351  tkt =
353  sizeof(struct GNUNET_RECLAIM_Ticket));
354  fprintf (stdout, "Ticket: %s | ID: %s | Audience: %s\n", tkt, ref, aud);
355  GNUNET_free (aud);
356  GNUNET_free (ref);
357  GNUNET_free (tkt);
359 }
360 
361 
362 static void
363 iter_error (void *cls)
364 {
365  attr_iterator = NULL;
366  cred_iterator = NULL;
367  fprintf (stderr, "Failed\n");
368 
370 }
371 
372 
373 static void
374 timeout_task (void *cls)
375 {
376  timeout = NULL;
377  ret = 1;
378  fprintf (stderr, "Timeout\n");
379  if (NULL == cleanup_task)
381 }
382 
383 
384 static void
385 process_rvk (void *cls, int success, const char *msg)
386 {
387  reclaim_op = NULL;
388  if (GNUNET_OK != success)
389  {
390  fprintf (stderr, "Revocation failed.\n");
391  ret = 1;
392  }
394 }
395 
396 
397 static void
398 process_delete (void *cls, int success, const char *msg)
399 {
400  reclaim_op = NULL;
401  if (GNUNET_OK != success)
402  {
403  fprintf (stderr, "Deletion failed.\n");
404  ret = 1;
405  }
407 }
408 
409 
410 static void
411 iter_finished (void *cls)
412 {
413  char *data;
414  size_t data_size;
415  int type;
416 
417  attr_iterator = NULL;
418  if (list)
419  {
421  return;
422  }
423 
424  if (issue_attrs)
425  {
427  pkey,
428  &rp_key,
429  attr_list,
431  NULL);
432  return;
433  }
434  if (consume_ticket)
435  {
437  pkey,
438  &ticket,
439  &process_attrs,
440  NULL);
443  &timeout_task,
444  NULL);
445  return;
446  }
447  if (revoke_ticket)
448  {
450  pkey,
451  &ticket,
452  &process_rvk,
453  NULL);
454  return;
455  }
456  if (attr_delete)
457  {
458  if (NULL == attr_to_delete)
459  {
460  fprintf (stdout, "No such attribute ``%s''\n", attr_delete);
462  return;
463  }
465  pkey,
468  NULL);
469  return;
470  }
471  if (attr_name)
472  {
473  if (NULL == type_str)
475  else
477 
480  attr_value,
481  (void **) &data,
482  &data_size));
483  if (NULL != claim)
484  {
485  claim->type = type;
486  claim->data = data;
488  }
489  else
490  {
491  claim =
493  }
494  if (NULL != credential_id)
495  {
497  }
499  pkey,
500  claim,
501  &exp_interval,
502  &store_cont,
503  NULL);
504  GNUNET_free (data);
505  GNUNET_free (claim);
506  return;
507  }
509 }
510 
511 
512 static void
513 iter_cb (void *cls,
514  const struct GNUNET_IDENTITY_PublicKey *identity,
515  const struct GNUNET_RECLAIM_Attribute *attr)
516 {
518  char *attrs_tmp;
519  char *attr_str;
520  char *label;
521  char *id;
522  const char *attr_type;
523 
524  if ((NULL != attr_name) && (NULL == claim))
525  {
526  if (0 == strcasecmp (attr_name, attr->name))
527  {
529  &attr->credential,
530  attr->type,
531  attr->data,
532  attr->data_size);
533  claim->id = attr->id;
534  }
535  }
536  else if (issue_attrs)
537  {
538  attrs_tmp = GNUNET_strdup (issue_attrs);
539  attr_str = strtok (attrs_tmp, ",");
540  while (NULL != attr_str)
541  {
542  if (0 != strcasecmp (attr_str, attr->name))
543  {
544  attr_str = strtok (NULL, ",");
545  continue;
546  }
549  &attr->credential,
550  attr->type,
551  attr->data,
552  attr->data_size);
553  le->attribute->flag = attr->flag;
554  le->attribute->id = attr->id;
557  le);
558  break;
559  }
560  GNUNET_free (attrs_tmp);
561  }
562  else if (attr_delete && (NULL == attr_to_delete))
563  {
564  label = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
565  if (0 == strcasecmp (attr_delete, label))
566  {
568  &attr->credential,
569  attr->type,
570  attr->data,
571  attr->data_size);
572  attr_to_delete->id = attr->id;
573  }
574  GNUNET_free (label);
575  }
576  else if (list)
577  {
579  attr->data,
580  attr->data_size);
582  id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
584  {
585  fprintf (stdout,
586  "%s: ``%s'' (%s); ID: %s\n",
587  attr->name,
588  attr_str,
589  attr_type,
590  id);
591  }
592  else
593  {
594  char *cred_id =
596  sizeof(attr->credential));
597  fprintf (stdout,
598  "%s: ``%s'' in credential presentation `%s' (%s); ID: %s\n",
599  attr->name,
600  attr_str,
601  cred_id,
602  attr_type,
603  id);
604  GNUNET_free (cred_id);
605 
606  }
607  GNUNET_free (id);
608  }
610 }
611 
612 
613 static void
615 {
616  cred_iterator = NULL;
617 
618  // Add new credential
619  if ((NULL != credential_name) &&
620  (NULL != attr_value))
621  {
622  enum GNUNET_RECLAIM_CredentialType ctype =
626  ctype,
627  attr_value,
628  strlen (attr_value));
630  pkey,
631  credential,
632  &exp_interval,
633  store_cont,
634  NULL);
635  return;
636 
637  }
638  if (list_credentials)
639  {
641  return;
642  }
644  pkey,
645  &iter_error,
646  NULL,
647  &iter_cb,
648  NULL,
649  &iter_finished,
650  NULL);
651 
652 }
653 
654 
655 static void
656 cred_iter_cb (void *cls,
657  const struct GNUNET_IDENTITY_PublicKey *identity,
658  const struct GNUNET_RECLAIM_Credential *cred)
659 {
660  char *cred_str;
661  char *attr_str;
662  char *id;
663  const char *cred_type;
665 
667  &cred->id))
669  if (list_credentials)
670  {
672  cred->data,
673  cred->data_size);
675  id = GNUNET_STRINGS_data_to_string_alloc (&cred->id, sizeof(cred->id));
676  fprintf (stdout,
677  "%s: ``%s'' (%s); ID: %s\n",
678  cred->name,
679  cred_str,
680  cred_type,
681  id);
682  struct GNUNET_RECLAIM_AttributeList *attrs =
684  if (NULL != attrs)
685  {
686  fprintf (stdout,
687  "\t Attributes:\n");
688  for (ale = attrs->list_head; NULL != ale; ale = ale->next)
689  {
691  ale->attribute->type,
692  ale->attribute->data,
693  ale->attribute->data_size);
694  fprintf (stdout,
695  "\t %s: %s\n", ale->attribute->name, attr_str);
696  GNUNET_free (attr_str);
697  }
699  }
700  GNUNET_free (id);
701  }
703 }
704 
705 
706 static void
708 {
709  if (NULL == pkey)
710  {
711  fprintf (stderr, "Ego %s not found\n", ego_name);
713  return;
714  }
715  if (NULL == credential_type)
716  credential_type = GNUNET_strdup ("JWT");
718  if (NULL != credential_id)
720  strlen (credential_id),
721  &credential, sizeof(credential));
723  if (list_tickets)
724  {
726  pkey,
728  NULL,
729  &ticket_iter,
730  NULL,
732  NULL);
733  return;
734  }
735 
736  if ((NULL != rp) &&
737  (GNUNET_OK !=
739  {
740  fprintf (stderr, "%s is not a public key!\n", rp);
742  return;
743  }
744  if (NULL != consume_ticket)
746  strlen (consume_ticket),
747  &ticket,
748  sizeof(struct GNUNET_RECLAIM_Ticket));
749  if (NULL != revoke_ticket)
751  strlen (revoke_ticket),
752  &ticket,
753  sizeof(struct GNUNET_RECLAIM_Ticket));
754 
756  claim = NULL;
758  pkey,
759  &iter_error,
760  NULL,
761  &cred_iter_cb,
762  NULL,
764  NULL);
765 
766 }
767 
768 
769 static int init = GNUNET_YES;
770 
771 static void
772 ego_cb (void *cls,
773  struct GNUNET_IDENTITY_Ego *ego,
774  void **ctx,
775  const char *name)
776 {
777  if (NULL == name)
778  {
779  if (GNUNET_YES == init)
780  {
781  init = GNUNET_NO;
782  start_process ();
783  }
784  return;
785  }
786  if (0 != strcmp (name, ego_name))
787  return;
789 }
790 
791 
792 static void
793 run (void *cls,
794  char *const *args,
795  const char *cfgfile,
796  const struct GNUNET_CONFIGURATION_Handle *c)
797 {
798  ret = 0;
799  if (NULL == ego_name)
800  {
801  ret = 1;
802  fprintf (stderr, _ ("Ego is required\n"));
803  return;
804  }
805 
806  if ((NULL == attr_value) && (NULL != attr_name))
807  {
808  ret = 1;
809  fprintf (stderr, _ ("Attribute value missing!\n"));
810  return;
811  }
812 
813  if ((NULL == rp) && (NULL != issue_attrs))
814  {
815  ret = 1;
816  fprintf (stderr, _ ("Requesting party key is required!\n"));
817  return;
818  }
819 
821  // Get Ego
823 }
824 
825 
826 int
827 main (int argc, char *const argv[])
828 {
832  "add",
833  "NAME",
834  gettext_noop ("Add or update an attribute NAME"),
835  &attr_name),
837  "delete",
838  "ID",
839  gettext_noop ("Delete the attribute with ID"),
840  &attr_delete),
842  "value",
843  "VALUE",
844  gettext_noop ("The attribute VALUE"),
845  &attr_value),
847  "ego",
848  "EGO",
849  gettext_noop ("The EGO to use"),
850  &ego_name),
852  "rp",
853  "RP",
854  gettext_noop (
855  "Specify the relying party for issue"),
856  &rp),
858  "dump",
859  gettext_noop ("List attributes for EGO"),
860  &list),
862  "credentials",
863  gettext_noop ("List credentials for EGO"),
866  "credential-id",
867  "CREDENTIAL_ID",
868  gettext_noop (
869  "Credential to use for attribute"),
870  &credential_id),
872  "credential-name",
873  "NAME",
874  gettext_noop ("Credential name"),
875  &credential_name),
877  "issue",
878  "A1,A2,...",
879  gettext_noop (
880  "Issue a ticket for a set of attributes separated by comma"),
881  &issue_attrs),
883  "consume",
884  "TICKET",
885  gettext_noop ("Consume a ticket"),
886  &consume_ticket),
888  "revoke",
889  "TICKET",
890  gettext_noop ("Revoke a ticket"),
891  &revoke_ticket),
893  "type",
894  "TYPE",
895  gettext_noop ("Type of attribute"),
896  &type_str),
898  "credential-type",
899  "TYPE",
900  gettext_noop ("Type of credential"),
901  &credential_type),
903  "tickets",
904  gettext_noop ("List tickets of ego"),
905  &list_tickets),
907  "expiration",
908  "INTERVAL",
909  gettext_noop (
910  "Expiration interval of the attribute"),
911  &exp_interval),
912 
914  };
915  if (GNUNET_OK != GNUNET_PROGRAM_run (argc,
916  argv,
917  "gnunet-reclaim",
918  _ ("re:claimID command line tool"),
919  options,
920  &run,
921  NULL))
922  return 1;
923  else
924  return ret;
925 }
struct GNUNET_GETOPT_CommandLineOption GNUNET_GETOPT_OPTION_END
Definition: 002.c:13
struct GNUNET_GETOPT_CommandLineOption options[]
Definition: 002.c:5
struct GNUNET_MessageHeader * msg
Definition: 005.c:2
#define gettext_noop(String)
Definition: gettext.h:69
static size_t data_size
Number of bytes in data.
Definition: gnunet-abd.c:187
static struct GNUNET_IDENTITY_Handle * id
Handle to identity service.
uint32_t data
The data value.
static struct GNUNET_IDENTITY_Handle * identity
Which namespace do we publish to? NULL if we do not publish to a namespace.
static void do_cleanup(void *cls)
static void ticket_issue_cb(void *cls, const struct GNUNET_RECLAIM_Ticket *ticket, const struct GNUNET_RECLAIM_PresentationList *presentations)
static struct GNUNET_TIME_Relative exp_interval
Attribute expiration interval.
static void iter_error(void *cls)
static void process_attrs(void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr, const struct GNUNET_RECLAIM_Presentation *presentation)
static void iter_cb(void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr)
struct GNUNET_RECLAIM_Attribute * claim
Claim to store.
static int credential_exists
Credential exists.
static void process_delete(void *cls, int success, const char *msg)
static struct GNUNET_RECLAIM_Handle * reclaim_handle
reclaim handle
static void ego_cb(void *cls, struct GNUNET_IDENTITY_Ego *ego, void **ctx, const char *name)
static char * attr_name
The attribute.
static struct GNUNET_RECLAIM_Ticket ticket
Ticket to consume.
static char * rp
Relying party.
static struct GNUNET_SCHEDULER_Task * timeout
Timeout task.
static char * credential_type
Credential type.
static void ticket_iter_fin(void *cls)
static void timeout_task(void *cls)
static int list
List attribute flag.
static struct GNUNET_RECLAIM_Attribute * attr_to_delete
Claim object to delete.
static struct GNUNET_RECLAIM_Operation * reclaim_op
reclaim operation
static struct GNUNET_RECLAIM_AttributeIterator * attr_iterator
Attribute iterator.
static struct GNUNET_IDENTITY_PublicKey rp_key
rp public key
static void ticket_iter_err(void *cls)
static struct GNUNET_RECLAIM_TicketIterator * ticket_iterator
Ticket iterator.
static int ret
return value
static char * attr_value
Attribute value.
static const struct GNUNET_IDENTITY_PrivateKey * pkey
ego private key
static struct GNUNET_SCHEDULER_Task * cleanup_task
Cleanup task.
static char * issue_attrs
Attributes to issue.
static int list_tickets
Ticket listing.
static int init
static char * attr_delete
Claim to delete.
static char * ego_name
Ego name.
static void ticket_iter(void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
static void run(void *cls, char *const *args, const char *cfgfile, const struct GNUNET_CONFIGURATION_Handle *c)
static char * credential_name
Credential name.
static void process_rvk(void *cls, int success, const char *msg)
static char * consume_ticket
Ticket to consume.
static struct GNUNET_RECLAIM_Identifier credential
Credential ID.
static void start_process()
static void cred_iter_finished(void *cls)
static struct GNUNET_IDENTITY_Handle * identity_handle
Identity handle.
static int list_credentials
List credentials flag.
static struct GNUNET_RECLAIM_AttributeList * attr_list
Attribute list.
static char * revoke_ticket
Ticket to revoke.
static char * type_str
Attribute type.
static char * credential_id
Credential ID string.
static void store_cont(void *cls, int32_t success, const char *emsg)
static void iter_finished(void *cls)
static void cred_iter_cb(void *cls, const struct GNUNET_IDENTITY_PublicKey *identity, const struct GNUNET_RECLAIM_Credential *cred)
int main(int argc, char *const argv[])
static struct GNUNET_RECLAIM_CredentialIterator * cred_iterator
Credential iterator.
static struct GNUNET_DNSSTUB_Context * ctx
Context for DNS resolution.
@ GNUNET_OK
Definition: gnunet_common.h:95
@ GNUNET_YES
Definition: gnunet_common.h:97
@ GNUNET_NO
Definition: gnunet_common.h:94
@ GNUNET_SYSERR
Definition: gnunet_common.h:93
#define GNUNET_CONTAINER_DLL_insert(head, tail, element)
Insert an element at the head of a DLL.
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).
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.
const struct GNUNET_IDENTITY_PrivateKey * GNUNET_IDENTITY_ego_get_private_key(const struct GNUNET_IDENTITY_Ego *ego)
Obtain the ECC key associated with a ego.
Definition: identity_api.c:639
enum GNUNET_GenericReturnValue GNUNET_IDENTITY_public_key_from_string(const char *str, struct GNUNET_IDENTITY_PublicKey *key)
Parses a (Base32) string representation of the public key.
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:610
void GNUNET_IDENTITY_disconnect(struct GNUNET_IDENTITY_Handle *h)
Disconnect from identity service.
Definition: identity_api.c:921
#define GNUNET_assert(cond)
Use this for fatal errors that cannot be handled.
#define GNUNET_strdup(a)
Wrapper around GNUNET_xstrdup_.
#define GNUNET_new(type)
Allocate a struct or union of the given type.
#define GNUNET_free(ptr)
Wrapper around free.
enum GNUNET_GenericReturnValue 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,...
Definition: program.c:399
#define GNUNET_RECLAIM_id_is_equal(a, b)
char * GNUNET_RECLAIM_credential_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the 'claim' of an credential to a string.
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 'claim' of an attribute to the binary representation.
void GNUNET_RECLAIM_attribute_list_destroy(struct GNUNET_RECLAIM_AttributeList *attrs)
Destroy claim list.
struct GNUNET_RECLAIM_Credential * GNUNET_RECLAIM_credential_new(const char *name, uint32_t type, const void *data, size_t data_size)
Create a new credential.
const char * GNUNET_RECLAIM_credential_number_to_typename(uint32_t type)
Convert an credential type number to the corresponding credential type string.
#define GNUNET_RECLAIM_id_is_zero(a)
char * GNUNET_RECLAIM_attribute_value_to_string(uint32_t type, const void *data, size_t data_size)
Convert the 'claim' of an attribute to a string.
static const struct GNUNET_RECLAIM_Identifier GNUNET_RECLAIM_ID_ZERO
struct GNUNET_RECLAIM_Attribute * GNUNET_RECLAIM_attribute_new(const char *attr_name, const struct GNUNET_RECLAIM_Identifier *credential, uint32_t type, const void *data, size_t data_size)
Create a new attribute claim.
GNUNET_RECLAIM_CredentialType
uint32_t GNUNET_RECLAIM_credential_typename_to_number(const char *typename)
Convert an credential type name to the corresponding number.
const char * GNUNET_RECLAIM_attribute_number_to_typename(uint32_t type)
Convert a type number to the corresponding type string.
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_credential_get_attributes(const struct GNUNET_RECLAIM_Credential *cred)
Convert an credential type name to the corresponding number.
uint32_t GNUNET_RECLAIM_attribute_typename_to_number(const char *typename)
Convert a type name to the corresponding number.
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_presentation_get_attributes(const struct GNUNET_RECLAIM_Presentation *cred)
@ GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING
String attribute.
void GNUNET_RECLAIM_disconnect(struct GNUNET_RECLAIM_Handle *h)
Disconnect from identity provider service.
Definition: reclaim_api.c:1103
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_credential_store(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *pkey, const struct GNUNET_RECLAIM_Credential *credential, const struct GNUNET_TIME_Relative *exp_interval, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
Store a credential.
Definition: reclaim_api.c:1226
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:1679
struct GNUNET_RECLAIM_AttributeIterator * GNUNET_RECLAIM_get_attributes_start(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *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:1330
void GNUNET_RECLAIM_cancel(struct GNUNET_RECLAIM_Operation *op)
Cancel an identity provider operation.
Definition: reclaim_api.c:1088
void GNUNET_RECLAIM_get_attributes_stop(struct GNUNET_RECLAIM_AttributeIterator *it)
Stops iteration and releases the handle for further calls.
Definition: reclaim_api.c:1397
void GNUNET_RECLAIM_get_credentials_next(struct GNUNET_RECLAIM_CredentialIterator *ait)
Calls the record processor specified in GNUNET_RECLAIM_get_credentials_start for the next record.
Definition: reclaim_api.c:1486
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_attribute_store(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *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:1134
struct GNUNET_RECLAIM_CredentialIterator * GNUNET_RECLAIM_get_credentials_start(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *identity, GNUNET_SCHEDULER_TaskCallback error_cb, void *error_cb_cls, GNUNET_RECLAIM_CredentialResult proc, void *proc_cls, GNUNET_SCHEDULER_TaskCallback finish_cb, void *finish_cb_cls)
List all credentials for a local identity.
Definition: reclaim_api.c:1439
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:1376
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_ticket_issue(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *iss, const struct GNUNET_IDENTITY_PublicKey *rp, const struct GNUNET_RECLAIM_AttributeList *attrs, GNUNET_RECLAIM_IssueTicketCallback cb, void *cb_cls)
Issues a ticket to a relying party.
Definition: reclaim_api.c:1541
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_attribute_delete(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *pkey, const struct GNUNET_RECLAIM_Attribute *attr, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
Delete an attribute.
Definition: reclaim_api.c:1181
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_ticket_revoke(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *identity, const struct GNUNET_RECLAIM_Ticket *ticket, GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls)
Revoked an issued ticket.
Definition: reclaim_api.c:1730
struct GNUNET_RECLAIM_TicketIterator * GNUNET_RECLAIM_ticket_iteration_start(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *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:1635
struct GNUNET_RECLAIM_Handle * GNUNET_RECLAIM_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the re:claimID service.
Definition: reclaim_api.c:1063
void GNUNET_RECLAIM_get_credentials_stop(struct GNUNET_RECLAIM_CredentialIterator *ait)
Stops iteration and releases the handle for further calls.
Definition: reclaim_api.c:1508
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_ticket_consume(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_IDENTITY_PrivateKey *identity, const struct GNUNET_RECLAIM_Ticket *ticket, GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls)
Consumes an issued ticket.
Definition: reclaim_api.c:1589
void GNUNET_RECLAIM_ticket_iteration_stop(struct GNUNET_RECLAIM_TicketIterator *it)
Stops iteration and releases the handle for further calls.
Definition: reclaim_api.c:1699
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:1296
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:972
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:1269
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:764
enum GNUNET_GenericReturnValue 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:789
#define GNUNET_TIME_UNIT_HOURS
One hour.
#define GNUNET_TIME_UNIT_SECONDS
One second.
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:483
#define _(String)
GNU gettext support macro.
Definition: platform.h:177
const char * name
Definition of a command line option.
Handle for an ego.
Definition: identity.h:37
Handle for the service.
Definition: identity_api.c:96
A private key for an identity as per LSD0001.
An identity key as per LSD0001.
Handle for a attribute iterator operation.
Definition: reclaim_api.c:183
struct GNUNET_RECLAIM_Attribute * attribute
The attribute claim.
struct GNUNET_RECLAIM_AttributeListEntry * next
DLL.
A list of GNUNET_RECLAIM_Attribute structures.
struct GNUNET_RECLAIM_AttributeListEntry * list_tail
List tail.
struct GNUNET_RECLAIM_AttributeListEntry * list_head
List head.
const char * name
The name of the attribute.
struct GNUNET_RECLAIM_Identifier credential
Referenced ID of credential (may be GNUNET_RECLAIM_ID_ZERO if self-creded)
struct GNUNET_RECLAIM_Identifier id
ID.
uint32_t type
Type of Claim.
const void * data
Binary value stored as attribute value.
size_t data_size
Number of bytes in data.
Handle for a credential iterator operation.
Definition: reclaim_api.c:250
uint32_t type
Type/Format of Claim.
const char * name
The name of the credential.
const void * data
Binary value stored as credential value.
size_t data_size
Number of bytes in data.
struct GNUNET_RECLAIM_Identifier id
ID.
Handle to the service.
Definition: reclaim_api.c:318
A reclaim identifier FIXME maybe put this in a different namespace.
Handle for an operation with the service.
Definition: reclaim_api.c:42
A list of GNUNET_RECLAIM_Presentation structures.
A credential presentation.
Handle for a ticket iterator operation.
Definition: reclaim_api.c:120
The authorization ticket.
struct GNUNET_RECLAIM_Identifier rnd
The ticket random identifier.
struct GNUNET_IDENTITY_PublicKey audience
The ticket audience (= relying party)
Entry in list of pending tasks.
Definition: scheduler.c:135
Time for relative time used by GNUnet, in microseconds.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model