GNUnet 0.21.1
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
34#include "gnunet_signatures.h"
38static int ret;
39
43static int list;
44
49
53static char *credential_id;
54
59
63static char *credential_name;
64
68static char *credential_type;
69
74
78static char *rp;
79
83static char *attr_name;
84
88static char *attr_value;
89
93static char *issue_attrs;
94
98static char *consume_ticket;
99
103static char *type_str;
104
108static char *revoke_ticket;
109
113static int list_tickets;
114
118static char *ego_name;
119
124
129
134
139
144
145
150
151
155static const struct GNUNET_CRYPTO_PrivateKey *pkey;
156
161
166
171
176
181
186
191
195static char *attr_delete;
196
201
202static void
203do_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
232static void
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
253static void
254store_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
265static void
266process_attrs (void *cls,
267 const struct GNUNET_CRYPTO_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
325static void
327{
328 ticket_iterator = NULL;
329 fprintf (stderr, "Failed to iterate over tickets\n");
331}
332
333
334static void
336{
337 ticket_iterator = NULL;
339}
340
341
342static void
343ticket_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
365static void
366iter_error (void *cls)
367{
368 attr_iterator = NULL;
369 cred_iterator = NULL;
370 fprintf (stderr, "Failed\n");
371
373}
374
375
376static void
377timeout_task (void *cls)
378{
379 timeout = NULL;
380 ret = 1;
381 fprintf (stderr, "Timeout\n");
382 if (NULL == cleanup_task)
384}
385
386
387static void
388process_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
400static void
401process_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
413static void
414iter_finished (void *cls)
415{
417 char *attrs_tmp;
418 char *attr_str;
419 char *data;
420 size_t data_size;
421 int type;
422
423 attr_iterator = NULL;
424 if (list)
425 {
427 return;
428 }
429
430 if (issue_attrs)
431 {
432 attrs_tmp = GNUNET_strdup (issue_attrs);
433 attr_str = strtok (attrs_tmp, ",");
434 while (NULL != attr_str)
435 {
436 le = attr_list->list_head;
437 while (le)
438 {
439 if (0 == strcasecmp (attr_str, le->attribute->name))
440 break;
441
442 le = le->next;
443 }
444
445 if (! le)
446 {
447 fprintf (stdout, "No such attribute ``%s''\n", attr_str);
448 break;
449 }
450
451 attr_str = strtok (NULL, ",");
452 }
453 GNUNET_free (attrs_tmp);
454 if (NULL != attr_str)
455 {
457 return;
458 }
459
461 pkey,
462 &rp_key,
463 attr_list,
465 NULL);
466 return;
467 }
468 if (consume_ticket)
469 {
471 pkey,
472 &ticket,
474 NULL);
478 NULL);
479 return;
480 }
481 if (revoke_ticket)
482 {
484 pkey,
485 &ticket,
487 NULL);
488 return;
489 }
490 if (attr_delete)
491 {
492 if (NULL == attr_to_delete)
493 {
494 fprintf (stdout, "No such attribute ``%s''\n", attr_delete);
496 return;
497 }
499 pkey,
502 NULL);
503 return;
504 }
505 if (attr_name)
506 {
507 if (NULL == type_str)
509 else
511
515 (void **) &data,
516 &data_size));
517 if (NULL != claim)
518 {
519 claim->type = type;
520 claim->data = data;
522 }
523 else
524 {
525 claim =
527 }
528 if (NULL != credential_id)
529 {
531 }
533 pkey,
534 claim,
536 &store_cont,
537 NULL);
540 return;
541 }
543}
544
545
546static void
547iter_cb (void *cls,
548 const struct GNUNET_CRYPTO_PublicKey *identity,
549 const struct GNUNET_RECLAIM_Attribute *attr)
550{
552 char *attrs_tmp;
553 char *attr_str;
554 char *label;
555 char *id;
556 const char *attr_type;
557
558 if ((NULL != attr_name) && (NULL == claim))
559 {
560 if (0 == strcasecmp (attr_name, attr->name))
561 {
563 &attr->credential,
564 attr->type,
565 attr->data,
566 attr->data_size);
567 claim->id = attr->id;
568 }
569 }
570 else if (issue_attrs)
571 {
572 attrs_tmp = GNUNET_strdup (issue_attrs);
573 attr_str = strtok (attrs_tmp, ",");
574 while (NULL != attr_str)
575 {
576 if (0 != strcasecmp (attr_str, attr->name))
577 {
578 attr_str = strtok (NULL, ",");
579 continue;
580 }
583 &attr->credential,
584 attr->type,
585 attr->data,
586 attr->data_size);
587 le->attribute->flag = attr->flag;
588 le->attribute->id = attr->id;
591 le);
592 break;
593 }
594 GNUNET_free (attrs_tmp);
595 }
596 else if (attr_delete && (NULL == attr_to_delete))
597 {
598 label = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
599 if (0 == strcasecmp (attr_delete, label))
600 {
602 &attr->credential,
603 attr->type,
604 attr->data,
605 attr->data_size);
606 attr_to_delete->id = attr->id;
607 }
608 GNUNET_free (label);
609 }
610 else if (list)
611 {
613 attr->data,
614 attr->data_size);
616 id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
618 {
619 fprintf (stdout,
620 "%s: ``%s'' (%s); ID: %s\n",
621 attr->name,
622 attr_str,
623 attr_type,
624 id);
625 }
626 else
627 {
628 char *cred_id =
630 sizeof(attr->credential));
631 fprintf (stdout,
632 "%s: ``%s'' in credential presentation `%s' (%s); ID: %s\n",
633 attr->name,
634 attr_str,
635 cred_id,
636 attr_type,
637 id);
638 GNUNET_free (cred_id);
639
640 }
641 GNUNET_free (id);
642 }
644}
645
646
647static void
649{
650 cred_iterator = NULL;
651
652 // Add new credential
653 if ((NULL != credential_name) &&
654 (NULL != attr_value))
655 {
660 ctype,
662 strlen (attr_value));
664 pkey,
668 NULL);
669 return;
670
671 }
673 {
675 return;
676 }
678 pkey,
679 &iter_error,
680 NULL,
681 &iter_cb,
682 NULL,
684 NULL);
685
686}
687
688
689static void
690cred_iter_cb (void *cls,
691 const struct GNUNET_CRYPTO_PublicKey *identity,
692 const struct GNUNET_RECLAIM_Credential *cred)
693{
694 char *cred_str;
695 char *attr_str;
696 char *id;
697 const char *cred_type;
699
701 &cred->id))
704 {
706 cred->data,
707 cred->data_size);
709 id = GNUNET_STRINGS_data_to_string_alloc (&cred->id, sizeof(cred->id));
710 fprintf (stdout,
711 "%s: ``%s'' (%s); ID: %s\n",
712 cred->name,
713 cred_str,
714 cred_type,
715 id);
716 struct GNUNET_RECLAIM_AttributeList *attrs =
718 if (NULL != attrs)
719 {
720 fprintf (stdout,
721 "\t Attributes:\n");
722 for (ale = attrs->list_head; NULL != ale; ale = ale->next)
723 {
725 ale->attribute->type,
726 ale->attribute->data,
727 ale->attribute->data_size);
728 fprintf (stdout,
729 "\t %s: %s\n", ale->attribute->name, attr_str);
730 GNUNET_free (attr_str);
731 }
733 }
734 GNUNET_free (id);
735 }
737}
738
739
740static void
742{
743 if (NULL == pkey)
744 {
745 fprintf (stderr, "Ego %s not found\n", ego_name);
747 return;
748 }
749 if (NULL == credential_type)
752 if (NULL != credential_id)
754 strlen (credential_id),
755 &credential, sizeof(credential));
757 if (list_tickets)
758 {
760 pkey,
762 NULL,
764 NULL,
766 NULL);
767 return;
768 }
769
770 if ((NULL != rp) &&
771 (GNUNET_OK !=
773 {
774 fprintf (stderr, "%s is not a public key!\n", rp);
776 return;
777 }
778 if (NULL != consume_ticket)
780 strlen (consume_ticket),
781 &ticket,
782 sizeof(struct GNUNET_RECLAIM_Ticket));
783 if (NULL != revoke_ticket)
785 strlen (revoke_ticket),
786 &ticket,
787 sizeof(struct GNUNET_RECLAIM_Ticket));
788
790 claim = NULL;
792 pkey,
793 &iter_error,
794 NULL,
796 NULL,
798 NULL);
799
800}
801
802
803static int init = GNUNET_YES;
804
805static void
806ego_cb (void *cls,
807 struct GNUNET_IDENTITY_Ego *ego,
808 void **ctx,
809 const char *name)
810{
811 if (NULL == name)
812 {
813 if (GNUNET_YES == init)
814 {
815 init = GNUNET_NO;
816 start_process ();
817 }
818 return;
819 }
820 if (0 != strcmp (name, ego_name))
821 return;
823}
824
825
826static void
827run (void *cls,
828 char *const *args,
829 const char *cfgfile,
830 const struct GNUNET_CONFIGURATION_Handle *c)
831{
832 ret = 0;
833 if (NULL == ego_name)
834 {
835 ret = 1;
836 fprintf (stderr, _ ("Ego is required\n"));
837 return;
838 }
839
840 if ((NULL == attr_value) && (NULL != attr_name))
841 {
842 ret = 1;
843 fprintf (stderr, _ ("Attribute value missing!\n"));
844 return;
845 }
846
847 if ((NULL == rp) && (NULL != issue_attrs))
848 {
849 ret = 1;
850 fprintf (stderr, _ ("Requesting party key is required!\n"));
851 return;
852 }
853
855 // Get Ego
857}
858
859
860int
861main (int argc, char *const argv[])
862{
866 "add",
867 "NAME",
868 gettext_noop ("Add or update an attribute NAME"),
869 &attr_name),
871 "delete",
872 "ID",
873 gettext_noop ("Delete the attribute with ID"),
874 &attr_delete),
876 "value",
877 "VALUE",
878 gettext_noop ("The attribute VALUE"),
879 &attr_value),
881 "ego",
882 "EGO",
883 gettext_noop ("The EGO to use"),
884 &ego_name),
886 "rp",
887 "RP",
889 "Specify the relying party for issue"),
890 &rp),
892 "dump",
893 gettext_noop ("List attributes for EGO"),
894 &list),
896 "credentials",
897 gettext_noop ("List credentials for EGO"),
900 "credential-id",
901 "CREDENTIAL_ID",
903 "Credential to use for attribute"),
906 "credential-name",
907 "NAME",
908 gettext_noop ("Credential name"),
911 "issue",
912 "A1,A2,...",
914 "Issue a ticket for a set of attributes separated by comma"),
915 &issue_attrs),
917 "consume",
918 "TICKET",
919 gettext_noop ("Consume a ticket"),
922 "revoke",
923 "TICKET",
924 gettext_noop ("Revoke a ticket"),
927 "type",
928 "TYPE",
929 gettext_noop ("Type of attribute"),
930 &type_str),
932 "credential-type",
933 "TYPE",
934 gettext_noop ("Type of credential"),
937 "tickets",
938 gettext_noop ("List tickets of ego"),
939 &list_tickets),
941 "expiration",
942 "INTERVAL",
944 "Expiration interval of the attribute"),
945 &exp_interval),
946
948 };
949 if (GNUNET_OK != GNUNET_PROGRAM_run (argc,
950 argv,
951 "gnunet-reclaim",
952 _ ("re:claimID command line tool"),
953 options,
954 &run,
955 NULL))
956 return 1;
957 else
958 return ret;
959}
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 char * data
The data to insert into the dht.
static struct GNUNET_FS_Handle * ctx
static char * name
Name (label) of the records to list.
static struct GNUNET_IDENTITY_Handle * id
Handle to IDENTITY.
static uint32_t type
Type string converted to DNS type value.
static size_t data_size
Number of bytes in data.
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)
struct GNUNET_RECLAIM_Attribute * claim
Claim to store.
static void process_attrs(void *cls, const struct GNUNET_CRYPTO_PublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr, const struct GNUNET_RECLAIM_Presentation *presentation)
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 const struct GNUNET_CRYPTO_PrivateKey * pkey
ego private key
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_CRYPTO_PublicKey rp_key
rp public key
static struct GNUNET_RECLAIM_AttributeIterator * attr_iterator
Attribute iterator.
static void iter_cb(void *cls, const struct GNUNET_CRYPTO_PublicKey *identity, const struct GNUNET_RECLAIM_Attribute *attr)
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 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 cred_iter_cb(void *cls, const struct GNUNET_CRYPTO_PublicKey *identity, const struct GNUNET_RECLAIM_Credential *cred)
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)
int main(int argc, char *const argv[])
static struct GNUNET_RECLAIM_CredentialIterator * cred_iterator
Credential iterator.
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_CRYPTO_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:517
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:487
void GNUNET_IDENTITY_disconnect(struct GNUNET_IDENTITY_Handle *h)
Disconnect from identity service.
Definition: identity_api.c:732
enum GNUNET_GenericReturnValue GNUNET_CRYPTO_public_key_from_string(const char *str, struct GNUNET_CRYPTO_PublicKey *key)
Parses a (Base32) string representation of the public key.
Definition: crypto_pkey.c:571
@ 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)
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.
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.
#define GNUNET_RECLAIM_id_is_zero(a)
const char * GNUNET_RECLAIM_credential_number_to_typename(uint32_t type)
Convert an credential type number to the corresponding credential type string.
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_presentation_get_attributes(const struct GNUNET_RECLAIM_Presentation *cred)
static const struct GNUNET_RECLAIM_Identifier GNUNET_RECLAIM_ID_ZERO
struct GNUNET_RECLAIM_AttributeList * GNUNET_RECLAIM_credential_get_attributes(const struct GNUNET_RECLAIM_Credential *cred)
Convert an credential type name to the corresponding number.
GNUNET_RECLAIM_CredentialType
uint32_t GNUNET_RECLAIM_credential_typename_to_number(const char *typename)
Convert an credential type name to the corresponding number.
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.
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.
const char * GNUNET_RECLAIM_attribute_number_to_typename(uint32_t type)
Convert a type number to the corresponding type string.
uint32_t GNUNET_RECLAIM_attribute_typename_to_number(const char *typename)
Convert a type name to the corresponding number.
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.
@ 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:1145
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_credential_store(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_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:1249
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:1643
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_ticket_issue(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *iss, const struct GNUNET_CRYPTO_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:1491
void GNUNET_RECLAIM_cancel(struct GNUNET_RECLAIM_Operation *op)
Cancel an identity provider operation.
Definition: reclaim_api.c:1130
void GNUNET_RECLAIM_get_attributes_stop(struct GNUNET_RECLAIM_AttributeIterator *it)
Stops iteration and releases the handle for further calls.
Definition: reclaim_api.c:1393
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:1456
struct GNUNET_RECLAIM_AttributeIterator * GNUNET_RECLAIM_get_attributes_start(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_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:1334
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_ticket_revoke(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *identity, const struct GNUNET_RECLAIM_Ticket *ticket, GNUNET_RECLAIM_ContinuationWithStatus cb, void *cb_cls)
Revoked an issued ticket.
Definition: reclaim_api.c:1694
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:1379
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_ticket_consume(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *identity, const struct GNUNET_RECLAIM_Ticket *ticket, GNUNET_RECLAIM_AttributeTicketResult cb, void *cb_cls)
Consumes an issued ticket.
Definition: reclaim_api.c:1551
struct GNUNET_RECLAIM_Handle * GNUNET_RECLAIM_connect(const struct GNUNET_CONFIGURATION_Handle *cfg)
Connect to the re:claimID service.
Definition: reclaim_api.c:1113
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_attribute_store(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_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:1164
struct GNUNET_RECLAIM_Operation * GNUNET_RECLAIM_attribute_delete(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_PrivateKey *pkey, const struct GNUNET_RECLAIM_Attribute *attr, GNUNET_RECLAIM_ContinuationWithStatus cont, void *cont_cls)
Delete an attribute.
Definition: reclaim_api.c:1208
struct GNUNET_RECLAIM_TicketIterator * GNUNET_RECLAIM_ticket_iteration_start(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_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:1591
void GNUNET_RECLAIM_get_credentials_stop(struct GNUNET_RECLAIM_CredentialIterator *ait)
Stops iteration and releases the handle for further calls.
Definition: reclaim_api.c:1471
void GNUNET_RECLAIM_ticket_iteration_stop(struct GNUNET_RECLAIM_TicketIterator *it)
Stops iteration and releases the handle for further calls.
Definition: reclaim_api.c:1663
struct GNUNET_RECLAIM_CredentialIterator * GNUNET_RECLAIM_get_credentials_start(struct GNUNET_RECLAIM_Handle *h, const struct GNUNET_CRYPTO_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:1411
void * GNUNET_SCHEDULER_cancel(struct GNUNET_SCHEDULER_Task *task)
Cancel the task with the specified identifier.
Definition: scheduler.c:981
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:1305
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:1278
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:484
#define _(String)
GNU gettext support macro.
Definition: platform.h:178
A private key for an identity as per LSD0001.
An identity key as per LSD0001.
Definition of a command line option.
Handle for an ego.
Definition: identity.h:37
Handle for the service.
Definition: identity_api.c:97
Handle for a attribute iterator operation.
Definition: reclaim_api.c:181
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:248
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:316
A reclaim identifier FIXME maybe put this in a different namespace.
Handle for an operation with the service.
Definition: reclaim_api.c:40
A list of GNUNET_RECLAIM_Presentation structures.
A credential presentation.
Handle for a ticket iterator operation.
Definition: reclaim_api.c:118
The authorization ticket.
struct GNUNET_CRYPTO_PublicKey audience
The ticket audience (= relying party)
struct GNUNET_RECLAIM_Identifier rnd
The ticket random identifier.
Entry in list of pending tasks.
Definition: scheduler.c:136
Time for relative time used by GNUnet, in microseconds.