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.c924
1 files changed, 0 insertions, 924 deletions
diff --git a/src/reclaim/gnunet-reclaim.c b/src/reclaim/gnunet-reclaim.c
deleted file mode 100644
index cefb66b8f..000000000
--- a/src/reclaim/gnunet-reclaim.c
+++ /dev/null
@@ -1,924 +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 }
534 }
535 else if (issue_attrs)
536 {
537 attrs_tmp = GNUNET_strdup (issue_attrs);
538 attr_str = strtok (attrs_tmp, ",");
539 while (NULL != attr_str)
540 {
541 if (0 != strcasecmp (attr_str, attr->name))
542 {
543 attr_str = strtok (NULL, ",");
544 continue;
545 }
546 le = GNUNET_new (struct GNUNET_RECLAIM_AttributeListEntry);
547 le->attribute = GNUNET_RECLAIM_attribute_new (attr->name,
548 &attr->credential,
549 attr->type,
550 attr->data,
551 attr->data_size);
552 le->attribute->flag = attr->flag;
553 le->attribute->id = attr->id;
554 GNUNET_CONTAINER_DLL_insert (attr_list->list_head,
555 attr_list->list_tail,
556 le);
557 break;
558 }
559 GNUNET_free (attrs_tmp);
560 }
561 else if (attr_delete && (NULL == attr_to_delete))
562 {
563 label = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
564 if (0 == strcasecmp (attr_delete, label))
565 {
566 attr_to_delete = GNUNET_RECLAIM_attribute_new (attr->name,
567 &attr->credential,
568 attr->type,
569 attr->data,
570 attr->data_size);
571 attr_to_delete->id = attr->id;
572 }
573 GNUNET_free (label);
574 }
575 else if (list)
576 {
577 attr_str = GNUNET_RECLAIM_attribute_value_to_string (attr->type,
578 attr->data,
579 attr->data_size);
580 attr_type = GNUNET_RECLAIM_attribute_number_to_typename (attr->type);
581 id = GNUNET_STRINGS_data_to_string_alloc (&attr->id, sizeof(attr->id));
582 if (GNUNET_YES == GNUNET_RECLAIM_id_is_zero (&attr->credential))
583 {
584 fprintf (stdout,
585 "%s: ``%s'' (%s); ID: %s\n",
586 attr->name,
587 attr_str,
588 attr_type,
589 id);
590 }
591 else
592 {
593 char *cred_id =
594 GNUNET_STRINGS_data_to_string_alloc (&attr->credential,
595 sizeof(attr->credential));
596 fprintf (stdout,
597 "%s: ``%s'' in credential presentation `%s' (%s); ID: %s\n",
598 attr->name,
599 attr_str,
600 cred_id,
601 attr_type,
602 id);
603 GNUNET_free (cred_id);
604
605 }
606 GNUNET_free (id);
607 }
608 GNUNET_RECLAIM_get_attributes_next (attr_iterator);
609}
610
611
612static void
613cred_iter_finished (void *cls)
614{
615 cred_iterator = NULL;
616
617 // Add new credential
618 if ((NULL != credential_name) &&
619 (NULL != attr_value))
620 {
621 enum GNUNET_RECLAIM_CredentialType ctype =
622 GNUNET_RECLAIM_credential_typename_to_number (credential_type);
623 struct GNUNET_RECLAIM_Credential *credential =
624 GNUNET_RECLAIM_credential_new (credential_name,
625 ctype,
626 attr_value,
627 strlen (attr_value));
628 reclaim_op = GNUNET_RECLAIM_credential_store (reclaim_handle,
629 pkey,
630 credential,
631 &exp_interval,
632 store_cont,
633 NULL);
634 return;
635
636 }
637 if (list_credentials)
638 {
639 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
640 return;
641 }
642 attr_iterator = GNUNET_RECLAIM_get_attributes_start (reclaim_handle,
643 pkey,
644 &iter_error,
645 NULL,
646 &iter_cb,
647 NULL,
648 &iter_finished,
649 NULL);
650
651}
652
653
654static void
655cred_iter_cb (void *cls,
656 const struct GNUNET_IDENTITY_PublicKey *identity,
657 const struct GNUNET_RECLAIM_Credential *cred)
658{
659 char *cred_str;
660 char *attr_str;
661 char *id;
662 const char *cred_type;
663 struct GNUNET_RECLAIM_AttributeListEntry *ale;
664
665 if (GNUNET_YES == GNUNET_RECLAIM_id_is_equal (&credential,
666 &cred->id))
667 credential_exists = GNUNET_YES;
668 if (list_credentials)
669 {
670 cred_str = GNUNET_RECLAIM_credential_value_to_string (cred->type,
671 cred->data,
672 cred->data_size);
673 cred_type = GNUNET_RECLAIM_credential_number_to_typename (cred->type);
674 id = GNUNET_STRINGS_data_to_string_alloc (&cred->id, sizeof(cred->id));
675 fprintf (stdout,
676 "%s: ``%s'' (%s); ID: %s\n",
677 cred->name,
678 cred_str,
679 cred_type,
680 id);
681 struct GNUNET_RECLAIM_AttributeList *attrs =
682 GNUNET_RECLAIM_credential_get_attributes (cred);
683 if (NULL != attrs)
684 {
685 fprintf (stdout,
686 "\t Attributes:\n");
687 for (ale = attrs->list_head; NULL != ale; ale = ale->next)
688 {
689 attr_str = GNUNET_RECLAIM_attribute_value_to_string (
690 ale->attribute->type,
691 ale->attribute->data,
692 ale->attribute->data_size);
693 fprintf (stdout,
694 "\t %s: %s\n", ale->attribute->name, attr_str);
695 GNUNET_free (attr_str);
696 }
697 GNUNET_RECLAIM_attribute_list_destroy (attrs);
698 }
699 GNUNET_free (id);
700 }
701 GNUNET_RECLAIM_get_credentials_next (cred_iterator);
702}
703
704
705static void
706start_process ()
707{
708 if (NULL == pkey)
709 {
710 fprintf (stderr, "Ego %s not found\n", ego_name);
711 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
712 return;
713 }
714 if (NULL == credential_type)
715 credential_type = GNUNET_strdup ("JWT");
716 credential = GNUNET_RECLAIM_ID_ZERO;
717 if (NULL != credential_id)
718 GNUNET_STRINGS_string_to_data (credential_id,
719 strlen (credential_id),
720 &credential, sizeof(credential));
721 credential_exists = GNUNET_NO;
722 if (list_tickets)
723 {
724 ticket_iterator = GNUNET_RECLAIM_ticket_iteration_start (reclaim_handle,
725 pkey,
726 &ticket_iter_err,
727 NULL,
728 &ticket_iter,
729 NULL,
730 &ticket_iter_fin,
731 NULL);
732 return;
733 }
734
735 if ((NULL != rp) &&
736 (GNUNET_OK !=
737 GNUNET_IDENTITY_public_key_from_string (rp, &rp_key)) )
738 {
739 fprintf (stderr, "%s is not a public key!\n", rp);
740 cleanup_task = GNUNET_SCHEDULER_add_now (&do_cleanup, NULL);
741 return;
742 }
743 if (NULL != consume_ticket)
744 GNUNET_STRINGS_string_to_data (consume_ticket,
745 strlen (consume_ticket),
746 &ticket,
747 sizeof(struct GNUNET_RECLAIM_Ticket));
748 if (NULL != revoke_ticket)
749 GNUNET_STRINGS_string_to_data (revoke_ticket,
750 strlen (revoke_ticket),
751 &ticket,
752 sizeof(struct GNUNET_RECLAIM_Ticket));
753
754 attr_list = GNUNET_new (struct GNUNET_RECLAIM_AttributeList);
755 claim = NULL;
756 cred_iterator = GNUNET_RECLAIM_get_credentials_start (reclaim_handle,
757 pkey,
758 &iter_error,
759 NULL,
760 &cred_iter_cb,
761 NULL,
762 &cred_iter_finished,
763 NULL);
764
765}
766
767
768static int init = GNUNET_YES;
769
770static void
771ego_cb (void *cls,
772 struct GNUNET_IDENTITY_Ego *ego,
773 void **ctx,
774 const char *name)
775{
776 if (NULL == name)
777 {
778 if (GNUNET_YES == init)
779 {
780 init = GNUNET_NO;
781 start_process ();
782 }
783 return;
784 }
785 if (0 != strcmp (name, ego_name))
786 return;
787 pkey = GNUNET_IDENTITY_ego_get_private_key (ego);
788}
789
790
791static void
792run (void *cls,
793 char *const *args,
794 const char *cfgfile,
795 const struct GNUNET_CONFIGURATION_Handle *c)
796{
797 ret = 0;
798 if (NULL == ego_name)
799 {
800 ret = 1;
801 fprintf (stderr, _ ("Ego is required\n"));
802 return;
803 }
804
805 if ((NULL == attr_value) && (NULL != attr_name))
806 {
807 ret = 1;
808 fprintf (stderr, _ ("Attribute value missing!\n"));
809 return;
810 }
811
812 if ((NULL == rp) && (NULL != issue_attrs))
813 {
814 ret = 1;
815 fprintf (stderr, _ ("Requesting party key is required!\n"));
816 return;
817 }
818
819 reclaim_handle = GNUNET_RECLAIM_connect (c);
820 // Get Ego
821 identity_handle = GNUNET_IDENTITY_connect (c, &ego_cb, NULL);
822}
823
824
825int
826main (int argc, char *const argv[])
827{
828 exp_interval = GNUNET_TIME_UNIT_HOURS;
829 struct GNUNET_GETOPT_CommandLineOption options[] = {
830 GNUNET_GETOPT_option_string ('a',
831 "add",
832 "NAME",
833 gettext_noop ("Add an attribute NAME"),
834 &attr_name),
835 GNUNET_GETOPT_option_string ('d',
836 "delete",
837 "ID",
838 gettext_noop ("Delete the attribute with ID"),
839 &attr_delete),
840 GNUNET_GETOPT_option_string ('V',
841 "value",
842 "VALUE",
843 gettext_noop ("The attribute VALUE"),
844 &attr_value),
845 GNUNET_GETOPT_option_string ('e',
846 "ego",
847 "EGO",
848 gettext_noop ("The EGO to use"),
849 &ego_name),
850 GNUNET_GETOPT_option_string ('r',
851 "rp",
852 "RP",
853 gettext_noop (
854 "Specify the relying party for issue"),
855 &rp),
856 GNUNET_GETOPT_option_flag ('D',
857 "dump",
858 gettext_noop ("List attributes for EGO"),
859 &list),
860 GNUNET_GETOPT_option_flag ('A',
861 "credentials",
862 gettext_noop ("List credentials for EGO"),
863 &list_credentials),
864 GNUNET_GETOPT_option_string ('I',
865 "credential-id",
866 "CREDENTIAL_ID",
867 gettext_noop (
868 "Credential to use for attribute"),
869 &credential_id),
870 GNUNET_GETOPT_option_string ('N',
871 "credential-name",
872 "NAME",
873 gettext_noop ("Credential name"),
874 &credential_name),
875 GNUNET_GETOPT_option_string ('i',
876 "issue",
877 "A1,A2,...",
878 gettext_noop (
879 "Issue a ticket for a set of attributes separated by comma"),
880 &issue_attrs),
881 GNUNET_GETOPT_option_string ('C',
882 "consume",
883 "TICKET",
884 gettext_noop ("Consume a ticket"),
885 &consume_ticket),
886 GNUNET_GETOPT_option_string ('R',
887 "revoke",
888 "TICKET",
889 gettext_noop ("Revoke a ticket"),
890 &revoke_ticket),
891 GNUNET_GETOPT_option_string ('t',
892 "type",
893 "TYPE",
894 gettext_noop ("Type of attribute"),
895 &type_str),
896 GNUNET_GETOPT_option_string ('u',
897 "credential-type",
898 "TYPE",
899 gettext_noop ("Type of credential"),
900 &credential_type),
901 GNUNET_GETOPT_option_flag ('T',
902 "tickets",
903 gettext_noop ("List tickets of ego"),
904 &list_tickets),
905 GNUNET_GETOPT_option_relative_time ('E',
906 "expiration",
907 "INTERVAL",
908 gettext_noop (
909 "Expiration interval of the attribute"),
910 &exp_interval),
911
912 GNUNET_GETOPT_OPTION_END
913 };
914 if (GNUNET_OK != GNUNET_PROGRAM_run (argc,
915 argv,
916 "gnunet-reclaim",
917 _ ("re:claimID command line tool"),
918 options,
919 &run,
920 NULL))
921 return 1;
922 else
923 return ret;
924}