GNUnet  0.19.3
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)
221  {
223  attr_list = NULL;
224  }
225  if (NULL != attr_to_delete)
227  if (NULL == credential_type)
229 }
230 
231 
232 static void
233 ticket_issue_cb (void *cls,
234  const struct GNUNET_RECLAIM_Ticket *ticket,
235  const struct GNUNET_RECLAIM_PresentationList *presentations)
236 {
237  char *ticket_str;
238 
239  reclaim_op = NULL;
240  if (NULL != ticket)
241  {
242  ticket_str =
244  sizeof(
245  struct GNUNET_RECLAIM_Ticket));
246  printf ("%s\n", ticket_str);
247  GNUNET_free (ticket_str);
248  }
250 }
251 
252 
253 static void
254 store_cont (void *cls, int32_t success, const char *emsg)
255 {
256  reclaim_op = NULL;
257  if (GNUNET_SYSERR == success)
258  {
259  fprintf (stderr, "%s\n", emsg);
260  }
262 }
263 
264 
265 static void
266 process_attrs (void *cls,
267  const struct GNUNET_IDENTITY_PublicKey *identity,
268  const struct GNUNET_RECLAIM_Attribute *attr,
269  const struct GNUNET_RECLAIM_Presentation *presentation)
270 {
271  char *value_str;
272  char *id;
273  const char *attr_type;
274 
275  if (NULL == identity)
276  {
277  reclaim_op = NULL;
279  return;
280  }
281  if (NULL == attr)
282  {
283  ret = 1;
284  return;
285  }
287  id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
288  value_str = NULL;
289  if (NULL == presentation)
290  {
292  attr->data,
293  attr->data_size);
294  }
295  else
296  {
300 
301  for (ale = al->list_head; NULL != ale; ale = ale->next)
302  {
303  if (0 != strncmp (attr->data, ale->attribute->name, attr->data_size))
304  continue;
305  value_str
307  ale->attribute->data,
308  ale->attribute->data_size);
309  break;
310  }
311  }
312  fprintf (stdout,
313  "Name: %s; Value: %s (%s); Flag %u; ID: %s %s\n",
314  attr->name,
315  (NULL != value_str) ? value_str : "???",
316  attr_type,
317  attr->flag,
318  id,
319  (NULL == presentation) ? "" : "(ATTESTED)");
320  GNUNET_free (value_str);
321  GNUNET_free (id);
322 }
323 
324 
325 static void
326 ticket_iter_err (void *cls)
327 {
328  ticket_iterator = NULL;
329  fprintf (stderr, "Failed to iterate over tickets\n");
331 }
332 
333 
334 static void
335 ticket_iter_fin (void *cls)
336 {
337  ticket_iterator = NULL;
339 }
340 
341 
342 static void
343 ticket_iter (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
344 {
345  char *aud;
346  char *ref;
347  char *tkt;
348 
349  aud =
351  sizeof(struct
354  tkt =
356  sizeof(struct GNUNET_RECLAIM_Ticket));
357  fprintf (stdout, "Ticket: %s | ID: %s | Audience: %s\n", tkt, ref, aud);
358  GNUNET_free (aud);
359  GNUNET_free (ref);
360  GNUNET_free (tkt);
362 }
363 
364 
365 static void
366 iter_error (void *cls)
367 {
368  attr_iterator = NULL;
369  cred_iterator = NULL;
370  fprintf (stderr, "Failed\n");
371 
373 }
374 
375 
376 static void
377 timeout_task (void *cls)
378 {
379  timeout = NULL;
380  ret = 1;
381  fprintf (stderr, "Timeout\n");
382  if (NULL == cleanup_task)
384 }
385 
386 
387 static void
388 process_rvk (void *cls, int success, const char *msg)
389 {
390  reclaim_op = NULL;
391  if (GNUNET_OK != success)
392  {
393  fprintf (stderr, "Revocation failed.\n");
394  ret = 1;
395  }
397 }
398 
399 
400 static void
401 process_delete (void *cls, int success, const char *msg)
402 {
403  reclaim_op = NULL;
404  if (GNUNET_OK != success)
405  {
406  fprintf (stderr, "Deletion failed.\n");
407  ret = 1;
408  }
410 }
411 
412 
413 static void
414 iter_finished (void *cls)
415 {
416  char *data;
417  size_t data_size;
418  int type;
419 
420  attr_iterator = NULL;
421  if (list)
422  {
424  return;
425  }
426 
427  if (issue_attrs)
428  {
430  pkey,
431  &rp_key,
432  attr_list,
434  NULL);
435  return;
436  }
437  if (consume_ticket)
438  {
440  pkey,
441  &ticket,
442  &process_attrs,
443  NULL);
446  &timeout_task,
447  NULL);
448  return;
449  }
450  if (revoke_ticket)
451  {
453  pkey,
454  &ticket,
455  &process_rvk,
456  NULL);
457  return;
458  }
459  if (attr_delete)
460  {
461  if (NULL == attr_to_delete)
462  {
463  fprintf (stdout, "No such attribute ``%s''\n", attr_delete);
465  return;
466  }
468  pkey,
471  NULL);
472  return;
473  }
474  if (attr_name)
475  {
476  if (NULL == type_str)
478  else
480 
483  attr_value,
484  (void **) &data,
485  &data_size));
486  if (NULL != claim)
487  {
488  claim->type = type;
489  claim->data = data;
491  }
492  else
493  {
494  claim =
496  }
497  if (NULL != credential_id)
498  {
500  }
502  pkey,
503  claim,
504  &exp_interval,
505  &store_cont,
506  NULL);
507  GNUNET_free (data);
508  GNUNET_free (claim);
509  return;
510  }
512 }
513 
514 
515 static void
516 iter_cb (void *cls,
517  const struct GNUNET_IDENTITY_PublicKey *identity,
518  const struct GNUNET_RECLAIM_Attribute *attr)
519 {
521  char *attrs_tmp;
522  char *attr_str;
523  char *label;
524  char *id;
525  const char *attr_type;
526 
527  if ((NULL != attr_name) && (NULL == claim))
528  {
529  if (0 == strcasecmp (attr_name, attr->name))
530  {
532  &attr->credential,
533  attr->type,
534  attr->data,
535  attr->data_size);
536  claim->id = attr->id;
537  }
538  }
539  else if (issue_attrs)
540  {
541  attrs_tmp = GNUNET_strdup (issue_attrs);
542  attr_str = strtok (attrs_tmp, ",");
543  while (NULL != attr_str)
544  {
545  if (0 != strcasecmp (attr_str, attr->name))
546  {
547  attr_str = strtok (NULL, ",");
548  continue;
549  }
552  &attr->credential,
553  attr->type,
554  attr->data,
555  attr->data_size);
556  le->attribute->flag = attr->flag;
557  le->attribute->id = attr->id;
560  le);
561  break;
562  }
563  GNUNET_free (attrs_tmp);
564  }
565  else if (attr_delete && (NULL == attr_to_delete))
566  {
567  label = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
568  if (0 == strcasecmp (attr_delete, label))
569  {
571  &attr->credential,
572  attr->type,
573  attr->data,
574  attr->data_size);
575  attr_to_delete->id = attr->id;
576  }
577  GNUNET_free (label);
578  }
579  else if (list)
580  {
582  attr->data,
583  attr->data_size);
585  id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
587  {
588  fprintf (stdout,
589  "%s: ``%s'' (%s); ID: %s\n",
590  attr->name,
591  attr_str,
592  attr_type,
593  id);
594  }
595  else
596  {
597  char *cred_id =
599  sizeof(attr->credential));
600  fprintf (stdout,
601  "%s: ``%s'' in credential presentation `%s' (%s); ID: %s\n",
602  attr->name,
603  attr_str,
604  cred_id,
605  attr_type,
606  id);
607  GNUNET_free (cred_id);
608 
609  }
610  GNUNET_free (id);
611  }
613 }
614 
615 
616 static void
618 {
619  cred_iterator = NULL;
620 
621  // Add new credential
622  if ((NULL != credential_name) &&
623  (NULL != attr_value))
624  {
625  enum GNUNET_RECLAIM_CredentialType ctype =
629  ctype,
630  attr_value,
631  strlen (attr_value));
633  pkey,
634  credential,
635  &exp_interval,
636  store_cont,
637  NULL);
638  return;
639 
640  }
641  if (list_credentials)
642  {
644  return;
645  }
647  pkey,
648  &iter_error,
649  NULL,
650  &iter_cb,
651  NULL,
652  &iter_finished,
653  NULL);
654 
655 }
656 
657 
658 static void
659 cred_iter_cb (void *cls,
660  const struct GNUNET_IDENTITY_PublicKey *identity,
661  const struct GNUNET_RECLAIM_Credential *cred)
662 {
663  char *cred_str;
664  char *attr_str;
665  char *id;
666  const char *cred_type;
668 
670  &cred->id))
672  if (list_credentials)
673  {
675  cred->data,
676  cred->data_size);
678  id = GNUNET_STRINGS_data_to_string_alloc (&cred->id, sizeof(cred->id));
679  fprintf (stdout,
680  "%s: ``%s'' (%s); ID: %s\n",
681  cred->name,
682  cred_str,
683  cred_type,
684  id);
685  struct GNUNET_RECLAIM_AttributeList *attrs =
687  if (NULL != attrs)
688  {
689  fprintf (stdout,
690  "\t Attributes:\n");
691  for (ale = attrs->list_head; NULL != ale; ale = ale->next)
692  {
694  ale->attribute->type,
695  ale->attribute->data,
696  ale->attribute->data_size);
697  fprintf (stdout,
698  "\t %s: %s\n", ale->attribute->name, attr_str);
699  GNUNET_free (attr_str);
700  }
702  }
703  GNUNET_free (id);
704  }
706 }
707 
708 
709 static void
711 {
712  if (NULL == pkey)
713  {
714  fprintf (stderr, "Ego %s not found\n", ego_name);
716  return;
717  }
718  if (NULL == credential_type)
719  credential_type = GNUNET_strdup ("JWT");
721  if (NULL != credential_id)
723  strlen (credential_id),
724  &credential, sizeof(credential));
726  if (list_tickets)
727  {
729  pkey,
731  NULL,
732  &ticket_iter,
733  NULL,
735  NULL);
736  return;
737  }
738 
739  if ((NULL != rp) &&
740  (GNUNET_OK !=
742  {
743  fprintf (stderr, "%s is not a public key!\n", rp);
745  return;
746  }
747  if (NULL != consume_ticket)
749  strlen (consume_ticket),
750  &ticket,
751  sizeof(struct GNUNET_RECLAIM_Ticket));
752  if (NULL != revoke_ticket)
754  strlen (revoke_ticket),
755  &ticket,
756  sizeof(struct GNUNET_RECLAIM_Ticket));
757 
759  claim = NULL;
761  pkey,
762  &iter_error,
763  NULL,
764  &cred_iter_cb,
765  NULL,
767  NULL);
768 
769 }
770 
771 
772 static int init = GNUNET_YES;
773 
774 static void
775 ego_cb (void *cls,
776  struct GNUNET_IDENTITY_Ego *ego,
777  void **ctx,
778  const char *name)
779 {
780  if (NULL == name)
781  {
782  if (GNUNET_YES == init)
783  {
784  init = GNUNET_NO;
785  start_process ();
786  }
787  return;
788  }
789  if (0 != strcmp (name, ego_name))
790  return;
792 }
793 
794 
795 static void
796 run (void *cls,
797  char *const *args,
798  const char *cfgfile,
799  const struct GNUNET_CONFIGURATION_Handle *c)
800 {
801  ret = 0;
802  if (NULL == ego_name)
803  {
804  ret = 1;
805  fprintf (stderr, _ ("Ego is required\n"));
806  return;
807  }
808 
809  if ((NULL == attr_value) && (NULL != attr_name))
810  {
811  ret = 1;
812  fprintf (stderr, _ ("Attribute value missing!\n"));
813  return;
814  }
815 
816  if ((NULL == rp) && (NULL != issue_attrs))
817  {
818  ret = 1;
819  fprintf (stderr, _ ("Requesting party key is required!\n"));
820  return;
821  }
822 
824  // Get Ego
826 }
827 
828 
829 int
830 main (int argc, char *const argv[])
831 {
835  "add",
836  "NAME",
837  gettext_noop ("Add or update an attribute NAME"),
838  &attr_name),
840  "delete",
841  "ID",
842  gettext_noop ("Delete the attribute with ID"),
843  &attr_delete),
845  "value",
846  "VALUE",
847  gettext_noop ("The attribute VALUE"),
848  &attr_value),
850  "ego",
851  "EGO",
852  gettext_noop ("The EGO to use"),
853  &ego_name),
855  "rp",
856  "RP",
857  gettext_noop (
858  "Specify the relying party for issue"),
859  &rp),
861  "dump",
862  gettext_noop ("List attributes for EGO"),
863  &list),
865  "credentials",
866  gettext_noop ("List credentials for EGO"),
869  "credential-id",
870  "CREDENTIAL_ID",
871  gettext_noop (
872  "Credential to use for attribute"),
873  &credential_id),
875  "credential-name",
876  "NAME",
877  gettext_noop ("Credential name"),
878  &credential_name),
880  "issue",
881  "A1,A2,...",
882  gettext_noop (
883  "Issue a ticket for a set of attributes separated by comma"),
884  &issue_attrs),
886  "consume",
887  "TICKET",
888  gettext_noop ("Consume a ticket"),
889  &consume_ticket),
891  "revoke",
892  "TICKET",
893  gettext_noop ("Revoke a ticket"),
894  &revoke_ticket),
896  "type",
897  "TYPE",
898  gettext_noop ("Type of attribute"),
899  &type_str),
901  "credential-type",
902  "TYPE",
903  gettext_noop ("Type of credential"),
904  &credential_type),
906  "tickets",
907  gettext_noop ("List tickets of ego"),
908  &list_tickets),
910  "expiration",
911  "INTERVAL",
912  gettext_noop (
913  "Expiration interval of the attribute"),
914  &exp_interval),
915 
917  };
918  if (GNUNET_OK != GNUNET_PROGRAM_run (argc,
919  argv,
920  "gnunet-reclaim",
921  _ ("re:claimID command line tool"),
922  options,
923  &run,
924  NULL))
925  return 1;
926  else
927  return ret;
928 }
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:70
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.
Identity service; implements identity management for GNUnet.
API that can be used to store naming information on a GNUnet node;.
reclaim service; implements identity and personal data sharing for GNUnet
#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:560
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:531
void GNUNET_IDENTITY_disconnect(struct GNUNET_IDENTITY_Handle *h)
Disconnect from identity service.
Definition: identity_api.c:757
@ GNUNET_OK
@ GNUNET_YES
@ GNUNET_NO
@ GNUNET_SYSERR
#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:400
#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:1143
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:1247
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
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:1332
void GNUNET_RECLAIM_cancel(struct GNUNET_RECLAIM_Operation *op)
Cancel an identity provider operation.
Definition: reclaim_api.c:1128
void GNUNET_RECLAIM_get_attributes_stop(struct GNUNET_RECLAIM_AttributeIterator *it)
Stops iteration and releases the handle for further calls.
Definition: reclaim_api.c:1391
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:1454
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:1162
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:1409
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:1377
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:1489
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:1206
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:1692
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:1589
struct GNUNET_RECLAIM_Handle * GNUNET_RECLAIM_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the re:claimID service.
Definition: reclaim_api.c:1111
void GNUNET_RECLAIM_get_credentials_stop(struct GNUNET_RECLAIM_CredentialIterator *ait)
Stops iteration and releases the handle for further calls.
Definition: reclaim_api.c:1469
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:1549
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
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:1299
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:975
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:1272
char * GNUNET_STRINGS_data_to_string_alloc(const void *buf, size_t size)
Return the base32crockford encoding of the given buffer.
Definition: strings.c:763
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:788
#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:484
#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:97
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:182
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:249
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:317
A reclaim identifier FIXME maybe put this in a different namespace.
Handle for an operation with the service.
Definition: reclaim_api.c:41
A list of GNUNET_RECLAIM_Presentation structures.
A credential presentation.
Handle for a ticket iterator operation.
Definition: reclaim_api.c:119
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:136
Time for relative time used by GNUnet, in microseconds.
enum GNUNET_TESTBED_UnderlayLinkModelType type
the type of this model