aboutsummaryrefslogtreecommitdiff
path: root/src/reclaim/gnunet-reclaim.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/reclaim/gnunet-reclaim.c')
-rw-r--r--src/reclaim/gnunet-reclaim.c925
1 files changed, 0 insertions, 925 deletions
diff --git a/src/reclaim/gnunet-reclaim.c b/src/reclaim/gnunet-reclaim.c
deleted file mode 100644
index da5f90409..000000000
--- a/src/reclaim/gnunet-reclaim.c
+++ /dev/null
@@ -1,925 +0,0 @@
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 */
20/**
21 * @author Martin Schanzenbach
22 * @file src/reclaim/gnunet-reclaim.c
23 * @brief Identity Provider utility
24 *
25 */
26#include "platform.h"
27#include <inttypes.h>
28
29#include "gnunet_util_lib.h"
30
31#include "gnunet_identity_service.h"
32#include "gnunet_namestore_service.h"
33#include "gnunet_reclaim_service.h"
34#include "gnunet_signatures.h"
35/**
36 * return value
37 */
38static int ret;
39
40/**
41 * List attribute flag
42 */
43static int list;
44
45/**
46 * List credentials flag
47 */
48static int list_credentials;
49
50/**
51 * Credential ID string
52 */
53static char *credential_id;
54
55/**
56 * Credential ID
57 */
58static struct GNUNET_RECLAIM_Identifier credential;
59
60/**
61 * Credential name
62 */
63static char *credential_name;
64
65/**
66 * Credential type
67 */
68static char *credential_type;
69
70/**
71 * Credential exists
72 */
73static int credential_exists;
74
75/**
76 * Relying party
77 */
78static char *rp;
79
80/**
81 * The attribute
82 */
83static char *attr_name;
84
85/**
86 * Attribute value
87 */
88static char *attr_value;
89
90/**
91 * Attributes to issue
92 */
93static char *issue_attrs;
94
95/**
96 * Ticket to consume
97 */
98static char *consume_ticket;
99
100/**
101 * Attribute type
102 */
103static char *type_str;
104
105/**
106 * Ticket to revoke
107 */
108static char *revoke_ticket;
109
110/**
111 * Ticket listing
112 */
113static int list_tickets;
114
115/**
116 * Ego name
117 */
118static char *ego_name;
119
120/**
121 * Identity handle
122 */
123static struct GNUNET_IDENTITY_Handle *identity_handle;
124
125/**
126 * reclaim handle
127 */
128static struct GNUNET_RECLAIM_Handle *reclaim_handle;
129
130/**
131 * reclaim operation
132 */
133static struct GNUNET_RECLAIM_Operation *reclaim_op;
134
135/**
136 * Attribute iterator
137 */
138static struct GNUNET_RECLAIM_AttributeIterator *attr_iterator;
139
140/**
141 * Credential iterator
142 */
143static struct GNUNET_RECLAIM_CredentialIterator *cred_iterator;
144
145
146/**
147 * Ticket iterator
148 */
149static struct GNUNET_RECLAIM_TicketIterator *ticket_iterator;
150
151
152/**
153 * ego private key
154 */
155static const struct GNUNET_IDENTITY_PrivateKey *pkey;
156
157/**
158 * rp public key
159 */
160static struct GNUNET_IDENTITY_PublicKey rp_key;
161
162/**
163 * Ticket to consume
164 */
165static struct GNUNET_RECLAIM_Ticket ticket;
166
167/**
168 * Attribute list
169 */
170static struct GNUNET_RECLAIM_AttributeList *attr_list;
171
172/**
173 * Attribute expiration interval
174 */
175static struct GNUNET_TIME_Relative exp_interval;
176
177/**
178 * Timeout task
179 */
180static struct GNUNET_SCHEDULER_Task *timeout;
181
182/**
183 * Cleanup task
184 */
185static struct GNUNET_SCHEDULER_Task *cleanup_task;
186
187/**
188 * Claim to store
189 */
190struct GNUNET_RECLAIM_Attribute *claim;
191
192/**
193 * Claim to delete
194 */
195static char *attr_delete;
196
197/**
198 * Claim object to delete
199 */
200static struct GNUNET_RECLAIM_Attribute *attr_to_delete;
201
202static void
203do_cleanup (void *cls)
204{
205 cleanup_task = NULL;
206 if (NULL != timeout)
207 GNUNET_SCHEDULER_cancel (timeout);
208 if (NULL != reclaim_op)
209 GNUNET_RECLAIM_cancel (reclaim_op);
210 if (NULL != attr_iterator)
211 GNUNET_RECLAIM_get_attributes_stop (attr_iterator);
212 if (NULL != cred_iterator)
213 GNUNET_RECLAIM_get_credentials_stop (cred_iterator);
214 if (NULL != ticket_iterator)
215 GNUNET_RECLAIM_ticket_iteration_stop (ticket_iterator);
216 if (NULL != reclaim_handle)
217 GNUNET_RECLAIM_disconnect (reclaim_handle);
218 if (NULL != identity_handle)
219 GNUNET_IDENTITY_disconnect (identity_handle);
220 if (NULL != attr_list)
221 GNUNET_free (attr_list);
222 if (NULL != attr_to_delete)
223 GNUNET_free (attr_to_delete);
224 if (NULL == credential_type)
225 GNUNET_free (credential_type);
226}
227
228
229static void
230ticket_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 =
240 GNUNET_STRINGS_data_to_string_alloc (ticket,
241 sizeof(
242 struct GNUNET_RECLAIM_Ticket));
243 printf ("%s\n", ticket_str);
244 GNUNET_free (ticket_str);
245 }
246 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
247}
248
249
250static void
251store_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 }
258 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
259}
260
261
262static void
263process_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;
275 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
276 return;
277 }
278 if (NULL == attr)
279 {
280 ret = 1;
281 return;
282 }
283 attr_type = GNUNET_RECLAIM_attribute_number_to_typename (attr->type);
284 id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
285 value_str = NULL;
286 if (NULL == presentation)
287 {
288 value_str = GNUNET_RECLAIM_attribute_value_to_string (attr->type,
289 attr->data,
290 attr->data_size);
291 }
292 else
293 {
294 struct GNUNET_RECLAIM_AttributeListEntry *ale;
295 struct GNUNET_RECLAIM_AttributeList *al
296 = GNUNET_RECLAIM_presentation_get_attributes (presentation);
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
303 = GNUNET_RECLAIM_attribute_value_to_string (ale->attribute->type,
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
322static void
323ticket_iter_err (void *cls)
324{
325 ticket_iterator = NULL;
326 fprintf (stderr, "Failed to iterate over tickets\n");
327 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
328}
329
330
331static void
332ticket_iter_fin (void *cls)
333{
334 ticket_iterator = NULL;
335 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
336}
337
338
339static void
340ticket_iter (void *cls, const struct GNUNET_RECLAIM_Ticket *ticket)
341{
342 char *aud;
343 char *ref;
344 char *tkt;
345
346 aud =
347 GNUNET_STRINGS_data_to_string_alloc (&ticket->audience,
348 sizeof(struct
349 GNUNET_IDENTITY_PublicKey));
350 ref = GNUNET_STRINGS_data_to_string_alloc (&ticket->rnd, sizeof(ticket->rnd));
351 tkt =
352 GNUNET_STRINGS_data_to_string_alloc (ticket,
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);
358 GNUNET_RECLAIM_ticket_iteration_next (ticket_iterator);
359}
360
361
362static void
363iter_error (void *cls)
364{
365 attr_iterator = NULL;
366 cred_iterator = NULL;
367 fprintf (stderr, "Failed\n");
368
369 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
370}
371
372
373static void
374timeout_task (void *cls)
375{
376 timeout = NULL;
377 ret = 1;
378 fprintf (stderr, "Timeout\n");
379 if (NULL == cleanup_task)
380 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
381}
382
383
384static void
385process_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 }
393 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
394}
395
396
397static void
398process_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 }
406 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
407}
408
409
410static void
411iter_finished (void *cls)
412{
413 char *data;
414 size_t data_size;
415 int type;
416
417 attr_iterator = NULL;
418 if (list)
419 {
420 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
421 return;
422 }
423
424 if (issue_attrs)
425 {
426 reclaim_op = GNUNET_RECLAIM_ticket_issue (reclaim_handle,
427 pkey,
428 &rp_key,
429 attr_list,
430 &ticket_issue_cb,
431 NULL);
432 return;
433 }
434 if (consume_ticket)
435 {
436 reclaim_op = GNUNET_RECLAIM_ticket_consume (reclaim_handle,
437 pkey,
438 &ticket,
439 &process_attrs,
440 NULL);
441 timeout = GNUNET_SCHEDULER_add_delayed (
442 GNUNET_TIME_relative_multiply (GNUNET_TIME_UNIT_SECONDS, 10),
443 &timeout_task,
444 NULL);
445 return;
446 }
447 if (revoke_ticket)
448 {
449 reclaim_op = GNUNET_RECLAIM_ticket_revoke (reclaim_handle,
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);
461 GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
462 return;
463 }
464 reclaim_op = GNUNET_RECLAIM_attribute_delete (reclaim_handle,
465 pkey,
466 attr_to_delete,
467 &process_delete,
468 NULL);
469 return;
470 }
471 if (attr_name)
472 {
473 if (NULL == type_str)
474 type = GNUNET_RECLAIM_ATTRIBUTE_TYPE_STRING;
475 else
476 type = GNUNET_RECLAIM_attribute_typename_to_number (type_str);
477
478 GNUNET_assert (GNUNET_SYSERR !=
479 GNUNET_RECLAIM_attribute_string_to_value (type,
480 attr_value,
481 (void **) &data,
482 &data_size));
483 if (NULL != claim)
484 {
485 claim->type = type;
486 claim->data = data;
487 claim->data_size = data_size;
488 }
489 else
490 {
491 claim =
492 GNUNET_RECLAIM_attribute_new (attr_name, NULL, type, data, data_size);
493 }
494 if (NULL != credential_id)
495 {
496 claim->credential = credential;
497 }
498 reclaim_op = GNUNET_RECLAIM_attribute_store (reclaim_handle,
499 pkey,
500 claim,
501 &exp_interval,
502 &store_cont,
503 NULL);
504 GNUNET_free (data);
505 GNUNET_free (claim);
506 return;
507 }
508 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
509}
510
511
512static void
513iter_cb (void *cls,
514 const struct GNUNET_IDENTITY_PublicKey *identity,
515 const struct GNUNET_RECLAIM_Attribute *attr)
516{
517 struct GNUNET_RECLAIM_AttributeListEntry *le;
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 {
528 claim = GNUNET_RECLAIM_attribute_new (attr->name,
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 }
547 le = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry);
548 le->attribute = GNUNET_RECLAIM_attribute_new (attr->name,
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;
555 GNUNET_CONTAINER_DLL_insert (attr_list->list_head,
556 attr_list->list_tail,
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 {
567 attr_to_delete = GNUNET_RECLAIM_attribute_new (attr->name,
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 {
578 attr_str = GNUNET_RECLAIM_attribute_value_to_string (attr->type,
579 attr->data,
580 attr->data_size);
581 attr_type = GNUNET_RECLAIM_attribute_number_to_typename (attr->type);
582 id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
583 if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attr->credential))
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 =
595 GNUNET_STRINGS_data_to_string_alloc (&attr->credential,
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 }
609 GNUNET_RECLAIM_get_attributes_next (attr_iterator);
610}
611
612
613static void
614cred_iter_finished (void *cls)
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 =
623 GNUNET_RECLAIM_credential_typename_to_number (credential_type);
624 struct GNUNET_RECLAIM_Credential *credential =
625 GNUNET_RECLAIM_credential_new (credential_name,
626 ctype,
627 attr_value,
628 strlen (attr_value));
629 reclaim_op = GNUNET_RECLAIM_credential_store (reclaim_handle,
630 pkey,
631 credential,
632 &exp_interval,
633 store_cont,
634 NULL);
635 return;
636
637 }
638 if (list_credentials)
639 {
640 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
641 return;
642 }
643 attr_iterator = GNUNET_RECLAIM_get_attributes_start (reclaim_handle,
644 pkey,
645 &iter_error,
646 NULL,
647 &iter_cb,
648 NULL,
649 &iter_finished,
650 NULL);
651
652}
653
654
655static void
656cred_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;
664 struct GNUNET_RECLAIM_AttributeListEntry *ale;
665
666 if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (&credential,
667 &cred->id))
668 credential_exists = GNUNET_YES;
669 if (list_credentials)
670 {
671 cred_str = GNUNET_RECLAIM_credential_value_to_string (cred->type,
672 cred->data,
673 cred->data_size);
674 cred_type = GNUNET_RECLAIM_credential_number_to_typename (cred->type);
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 =
683 GNUNET_RECLAIM_credential_get_attributes (cred);
684 if (NULL != attrs)
685 {
686 fprintf (stdout,
687 "\t Attributes:\n");
688 for (ale = attrs->list_head; NULL != ale; ale = ale->next)
689 {
690 attr_str = GNUNET_RECLAIM_attribute_value_to_string (
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 }
698 GNUNET_RECLAIM_attribute_list_destroy (attrs);
699 }
700 GNUNET_free (id);
701 }
702 GNUNET_RECLAIM_get_credentials_next (cred_iterator);
703}
704
705
706static void
707start_process ()
708{
709 if (NULL == pkey)
710 {
711 fprintf (stderr, "Ego %s not found\n", ego_name);
712 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
713 return;
714 }
715 if (NULL == credential_type)
716 credential_type = GNUNET_strdup ("JWT");
717 credential = GNUNET_RECLAIM_ID_ZERO;
718 if (NULL != credential_id)
719 GNUNET_STRINGS_string_to_data (credential_id,
720 strlen (credential_id),
721 &credential, sizeof(credential));
722 credential_exists = GNUNET_NO;
723 if (list_tickets)
724 {
725 ticket_iterator = GNUNET_RECLAIM_ticket_iteration_start (reclaim_handle,
726 pkey,
727 &ticket_iter_err,
728 NULL,
729 &ticket_iter,
730 NULL,
731 &ticket_iter_fin,
732 NULL);
733 return;
734 }
735
736 if ((NULL != rp) &&
737 (GNUNET_OK !=
738 GNUNET_IDENTITY_public_key_from_string (rp, &rp_key)) )
739 {
740 fprintf (stderr, "%s is not a public key!\n", rp);
741 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
742 return;
743 }
744 if (NULL != consume_ticket)
745 GNUNET_STRINGS_string_to_data (consume_ticket,
746 strlen (consume_ticket),
747 &ticket,
748 sizeof(struct GNUNET_RECLAIM_Ticket));
749 if (NULL != revoke_ticket)
750 GNUNET_STRINGS_string_to_data (revoke_ticket,
751 strlen (revoke_ticket),
752 &ticket,
753 sizeof(struct GNUNET_RECLAIM_Ticket));
754
755 attr_list = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
756 claim = NULL;
757 cred_iterator = GNUNET_RECLAIM_get_credentials_start (reclaim_handle,
758 pkey,
759 &iter_error,
760 NULL,
761 &cred_iter_cb,
762 NULL,
763 &cred_iter_finished,
764 NULL);
765
766}
767
768
769static int init = GNUNET_YES;
770
771static void
772ego_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;
788 pkey = GNUNET_IDENTITY_ego_get_private_key (ego);
789}
790
791
792static void
793run (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
820 reclaim_handle = GNUNET_RECLAIM_connect (c);
821 // Get Ego
822 identity_handle = GNUNET_IDENTITY_connect (c, &ego_cb, NULL);
823}
824
825
826int
827main (int argc, char *const argv[])
828{
829 exp_interval = GNUNET_TIME_UNIT_HOURS;
830 struct GNUNET_GETOPT_CommandLineOption options[] = {
831 GNUNET_GETOPT_option_string ('a',
832 "add",
833 "NAME",
834 gettext_noop ("Add or update an attribute NAME"),
835 &attr_name),
836 GNUNET_GETOPT_option_string ('d',
837 "delete",
838 "ID",
839 gettext_noop ("Delete the attribute with ID"),
840 &attr_delete),
841 GNUNET_GETOPT_option_string ('V',
842 "value",
843 "VALUE",
844 gettext_noop ("The attribute VALUE"),
845 &attr_value),
846 GNUNET_GETOPT_option_string ('e',
847 "ego",
848 "EGO",
849 gettext_noop ("The EGO to use"),
850 &ego_name),
851 GNUNET_GETOPT_option_string ('r',
852 "rp",
853 "RP",
854 gettext_noop (
855 "Specify the relying party for issue"),
856 &rp),
857 GNUNET_GETOPT_option_flag ('D',
858 "dump",
859 gettext_noop ("List attributes for EGO"),
860 &list),
861 GNUNET_GETOPT_option_flag ('A',
862 "credentials",
863 gettext_noop ("List credentials for EGO"),
864 &list_credentials),
865 GNUNET_GETOPT_option_string ('I',
866 "credential-id",
867 "CREDENTIAL_ID",
868 gettext_noop (
869 "Credential to use for attribute"),
870 &credential_id),
871 GNUNET_GETOPT_option_string ('N',
872 "credential-name",
873 "NAME",
874 gettext_noop ("Credential name"),
875 &credential_name),
876 GNUNET_GETOPT_option_string ('i',
877 "issue",
878 "A1,A2,...",
879 gettext_noop (
880 "Issue a ticket for a set of attributes separated by comma"),
881 &issue_attrs),
882 GNUNET_GETOPT_option_string ('C',
883 "consume",
884 "TICKET",
885 gettext_noop ("Consume a ticket"),
886 &consume_ticket),
887 GNUNET_GETOPT_option_string ('R',
888 "revoke",
889 "TICKET",
890 gettext_noop ("Revoke a ticket"),
891 &revoke_ticket),
892 GNUNET_GETOPT_option_string ('t',
893 "type",
894 "TYPE",
895 gettext_noop ("Type of attribute"),
896 &type_str),
897 GNUNET_GETOPT_option_string ('u',
898 "credential-type",
899 "TYPE",
900 gettext_noop ("Type of credential"),
901 &credential_type),
902 GNUNET_GETOPT_option_flag ('T',
903 "tickets",
904 gettext_noop ("List tickets of ego"),
905 &list_tickets),
906 GNUNET_GETOPT_option_relative_time ('E',
907 "expiration",
908 "INTERVAL",
909 gettext_noop (
910 "Expiration interval of the attribute"),
911 &exp_interval),
912
913 GNUNET_GETOPT_OPTION_END
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}