aboutsummaryrefslogtreecommitdiff
path: root/src/credential/gnunet-credential.c
diff options
context:
space:
mode:
authorAndreas Ebner <pansy007@googlemail.com>2019-07-07 15:04:40 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2019-10-07 12:15:06 +0200
commitfc58d9d4241ed2dcd4b492b4f922ba959449a697 (patch)
tree812713718d2d93d70a3ee1a22b20d55e65969873 /src/credential/gnunet-credential.c
parentd2634b1f96dfd55ae4daef294bb6c05d687354c8 (diff)
downloadgnunet-fc58d9d4241ed2dcd4b492b4f922ba959449a697.tar.gz
gnunet-fc58d9d4241ed2dcd4b492b4f922ba959449a697.zip
Implemented delegate sign and store function for GNS entries:
- functions to store and sign delegates (all types) including serialization/string_to_value/.. - solved (almost) all TODOs - some renaming and cleanup in gnunet-credential.c - valgrind checked - test file adapted accordingly
Diffstat (limited to 'src/credential/gnunet-credential.c')
-rw-r--r--src/credential/gnunet-credential.c254
1 files changed, 72 insertions, 182 deletions
diff --git a/src/credential/gnunet-credential.c b/src/credential/gnunet-credential.c
index 35fa6ff8a..22fca7b00 100644
--- a/src/credential/gnunet-credential.c
+++ b/src/credential/gnunet-credential.c
@@ -28,6 +28,7 @@
28#include <gnunet_gnsrecord_lib.h> 28#include <gnunet_gnsrecord_lib.h>
29#include <gnunet_namestore_service.h> 29#include <gnunet_namestore_service.h>
30#include "credential_misc.h" 30#include "credential_misc.h"
31#include "delegate_misc.h"
31#include "credential_serialization.h" 32#include "credential_serialization.h"
32 33
33/** 34/**
@@ -78,7 +79,7 @@ static struct GNUNET_SCHEDULER_Task *tt;
78/** 79/**
79 * Subject pubkey string 80 * Subject pubkey string
80 */ 81 */
81static char *subject_key; 82static char *subject;
82 83
83/** 84/**
84 * Subject credential string 85 * Subject credential string
@@ -147,11 +148,6 @@ static int create_ss;
147static int sign_ss; 148static int sign_ss;
148 149
149/** 150/**
150 * Add mode
151 */
152static int add_iss;
153
154/**
155 * Signed issue credentials 151 * Signed issue credentials
156 */ 152 */
157static char *extension; 153static char *extension;
@@ -291,6 +287,7 @@ handle_verify_result (void *cls,
291 { 287 {
292 iss_key = GNUNET_CRYPTO_ecdsa_public_key_to_string (&dc[i].issuer_key); 288 iss_key = GNUNET_CRYPTO_ecdsa_public_key_to_string (&dc[i].issuer_key);
293 sub_key = GNUNET_CRYPTO_ecdsa_public_key_to_string (&dc[i].subject_key); 289 sub_key = GNUNET_CRYPTO_ecdsa_public_key_to_string (&dc[i].subject_key);
290
294 if (0 != dc[i].subject_attribute_len) 291 if (0 != dc[i].subject_attribute_len)
295 { 292 {
296 printf ("(%d) %s.%s <- %s.%s\n", i, 293 printf ("(%d) %s.%s <- %s.%s\n", i,
@@ -409,108 +406,34 @@ identity_cb (void *cls,
409 &etime_abs); 406 &etime_abs);
410 407
411 res = GNUNET_CREDENTIAL_credential_to_string (crd); 408 res = GNUNET_CREDENTIAL_credential_to_string (crd);
412 fprintf(stderr,"Cred: %s\n", res);
413 GNUNET_free (crd); 409 GNUNET_free (crd);
414 printf ("%s\n", res); 410 printf ("%s\n", res);
415 GNUNET_SCHEDULER_shutdown (); 411 GNUNET_SCHEDULER_shutdown ();
416} 412}
417 413
418
419static char
420*strtokm(char *str, const char *delim)
421{
422 static char *tok;
423 static char *next;
424 char *m;
425
426 if (delim == NULL) return NULL;
427
428 tok = (str) ? str : next;
429 if (tok == NULL) return NULL;
430
431 m = strstr(tok, delim);
432
433 if (m) {
434 next = m + strlen(delim);
435 *m = '\0';
436 } else {
437 next = NULL;
438 }
439
440 if (m == tok || *tok == '\0') return strtokm(NULL, delim);
441
442 return tok;
443}
444
445void topntail(char *str) {
446 size_t len = strlen(str);
447 // check if last char is a space, if yes: remove 2 chars at the end
448 if(str[len-1] == ' ')
449 {
450 len -= 1;
451 }
452 // remove first and last char
453 memmove(str, str+1, len-2);
454 str[len-2] = 0;
455}
456
457static int 414static int
458parse_cmdl_param(const char *extensionstring) 415parse_cmdl_param(const char *extensionstring)
459{ 416{
460 fprintf(stderr, "Starting to parse extension string...\n");
461 fprintf(stderr, "string to parse: %s\n", extensionstring);
462
463 //Example:
464 //--ego=epub --attribute=aasds --subject=DKCC5SMTBNV6W3VXDJ7A1N1YS6TRG7B3XC2S5N4HSXJEYYRFRCCG basd --ttl=60m
465 //--extension=NVTQZA44336VHKCP2SA20BR6899T621B2PJKC3V730AKXC37T6M0.aasds -> DKCC5SMTBNV6W3VXDJ7A1N1YS6TRG7B3XC2S5N4HSXJEYYRFRCCG | D1NuT8hHEUbkCURo1lkcSPKhYiydhv4nMkV042kc9J4MgIhB2/fQKLgJUyuGlJKvYgXLf4jHXNRHJe+aCLG7jw== | 1561126006528100
466
467 //TODO: parse, wenn nicht als argument direkt geparsed werden kann
468
469 char cmd_para[100];
470 char para_str[1024];
471 char *token; 417 char *token;
472 char *tmp_str; 418 char *tmp_str;
473 int matches = 0; 419 int counter = 0;
474 420
475 tmp_str = GNUNET_strdup (extensionstring); 421 tmp_str = GNUNET_strdup (extensionstring);
476 // use special strtok to match multiple characters 422 // split string via strtok, assume parameters are in the right order
477 token = strtokm (tmp_str, "--"); 423 token = strtok (tmp_str, ";");
478 while (NULL != token) { 424 while (NULL != token) {
479 // also fills the variables if "regex"-like match 425
480 fprintf(stderr, "TOKEN: %s\n", token); 426 // fill variables depending on counter
481 // match everything till =, ignore = (%*c), match everything including whitespaces (required for the extension parameter) 427 if(0 == counter) {
482 matches = SSCANF (token, "%[^=]%*c%[^\n]", cmd_para, para_str); 428 expiration = GNUNET_strdup(token);
483 // string not well formatted 429 } else if(1 == counter) {
484 if (0 == matches) { 430 extension = GNUNET_strdup(token);
485 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, ("Failed to parse to extensionstring.\n"));
486 GNUNET_SCHEDULER_shutdown ();
487 GNUNET_free (tmp_str);
488 return GNUNET_SYSERR;
489 } else { 431 } else {
490 fprintf(stderr,"Found command and parameter: %s %s\n", cmd_para, para_str); 432 GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Could not parse extension string\n");
491 // assign values to variables, topntail to remove trailing/leading "
492 if(strcmp(cmd_para, "ego") == 0) {
493 fprintf(stderr,"ego found and parsed\n");
494 topntail(para_str);
495 ego_name = GNUNET_strdup(para_str);
496 } else if(strcmp(cmd_para, "attribute") == 0) {
497 fprintf(stderr,"issuer found and parsed\n");
498 topntail(para_str);
499 issuer_attr = GNUNET_strdup(para_str);
500 } else if(strcmp(cmd_para, "subject") == 0) {
501 fprintf(stderr,"subject found and parsed\n");
502 topntail(para_str);
503 subject_key = GNUNET_strdup(para_str);
504 } else if(strcmp(cmd_para, "ttl") == 0) {
505 fprintf(stderr,"ttl found and parsed\n");
506 expiration = GNUNET_strdup(para_str);
507 } else if(strcmp(cmd_para, "extension") == 0) {
508 fprintf(stderr,"extension found and parsed\n");
509 topntail(para_str);
510 extension = GNUNET_strdup(para_str);
511 }
512 } 433 }
513 token = strtokm (NULL, "--"); 434
435 counter++;
436 token = strtok (NULL, ";");
514 } 437 }
515 GNUNET_free (tmp_str); 438 GNUNET_free (tmp_str);
516 439
@@ -531,7 +454,7 @@ parse_expiration (const char *expirationstring,
531 int *etime_is_rel, 454 int *etime_is_rel,
532 uint64_t *etime) 455 uint64_t *etime)
533{ 456{
534 // TODO just copied from gnunet-namestore.c 457 // copied from namestore/gnunet-namestore.c
535 struct GNUNET_TIME_Relative etime_rel; 458 struct GNUNET_TIME_Relative etime_rel;
536 struct GNUNET_TIME_Absolute etime_abs; 459 struct GNUNET_TIME_Absolute etime_abs;
537 460
@@ -574,8 +497,7 @@ parse_expiration (const char *expirationstring,
574static void 497static void
575error_cb (void *cls) 498error_cb (void *cls)
576{ 499{
577 // TODO: Better 500 fprintf(stderr, "Error occured during lookup, shutting down.\n");
578 fprintf(stderr, "In add_error_cb\n");
579 GNUNET_SCHEDULER_shutdown (); 501 GNUNET_SCHEDULER_shutdown ();
580 return; 502 return;
581} 503}
@@ -584,8 +506,7 @@ add_continuation (void *cls,
584 int32_t success, 506 int32_t success,
585 const char *emsg) 507 const char *emsg)
586{ 508{
587 fprintf(stderr, "Start: add_continuation\n"); 509 // TODO what does that do, can I somehow parse an empty callback on success or do I have to set the qe* to NULL?
588
589 struct GNUNET_NAMESTORE_QueueEntry **qe = cls; 510 struct GNUNET_NAMESTORE_QueueEntry **qe = cls;
590 *qe = NULL; 511 *qe = NULL;
591 512
@@ -602,11 +523,6 @@ get_existing_record (void *cls,
602 struct GNUNET_GNSRECORD_Data rdn[rd_count + 1]; 523 struct GNUNET_GNSRECORD_Data rdn[rd_count + 1];
603 struct GNUNET_GNSRECORD_Data *rde; 524 struct GNUNET_GNSRECORD_Data *rde;
604 525
605 fprintf(stderr, "Start: get_existing_record\n");
606
607 fprintf(stderr, "count: %d\n", rd_count);
608
609
610 memset (rdn, 0, sizeof (struct GNUNET_GNSRECORD_Data)); 526 memset (rdn, 0, sizeof (struct GNUNET_GNSRECORD_Data));
611 GNUNET_memcpy (&rdn[1], 527 GNUNET_memcpy (&rdn[1],
612 rd, 528 rd,
@@ -615,7 +531,7 @@ get_existing_record (void *cls,
615 rde->data = data; 531 rde->data = data;
616 rde->data_size = data_size; 532 rde->data_size = data_size;
617 rde->record_type = type; 533 rde->record_type = type;
618 // TODO: flags 534 // Flags not required , TODO what have we said we do with that now? Look it up in my writing
619 /*if (1 == is_shadow) 535 /*if (1 == is_shadow)
620 rde->flags |= GNUNET_GNSRECORD_RF_SHADOW_RECORD; 536 rde->flags |= GNUNET_GNSRECORD_RF_SHADOW_RECORD;
621 if (1 != is_public) 537 if (1 != is_public)
@@ -642,9 +558,8 @@ store_cb (void *cls,
642 const struct GNUNET_IDENTITY_Ego *ego) 558 const struct GNUNET_IDENTITY_Ego *ego)
643{ 559{
644 const struct GNUNET_CONFIGURATION_Handle *cfg = cls; 560 const struct GNUNET_CONFIGURATION_Handle *cfg = cls;
645 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
646 561
647 fprintf(stderr, "Start: store_cb\n"); 562 el = NULL;
648 563
649 ns = GNUNET_NAMESTORE_connect (cfg); 564 ns = GNUNET_NAMESTORE_connect (cfg);
650 if (NULL == ns) 565 if (NULL == ns)
@@ -656,14 +571,9 @@ store_cb (void *cls,
656 } 571 }
657 572
658 // Key handling 573 // Key handling
659 fprintf(stderr, "Connected to ns\n");
660 zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (ego); 574 zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (ego);
661 fprintf(stderr, "Got zone_pkey\n");
662 // TODO rename to zone_pub?
663 GNUNET_CRYPTO_ecdsa_key_get_public (&zone_pkey, &pub);
664 575
665 // Check relevant cmdline parameters 576 // Check relevant cmdline parameters
666 // name ⁼ issuer_attr
667 if (NULL == issuer_attr) 577 if (NULL == issuer_attr)
668 { 578 {
669 fprintf (stderr, "Missing option -attribute for operation 'create'.\n"); 579 fprintf (stderr, "Missing option -attribute for operation 'create'.\n");
@@ -671,9 +581,7 @@ store_cb (void *cls,
671 return; 581 return;
672 } 582 }
673 583
674 // TODO later, rename subject_key to subject 584 if (NULL == subject)
675 // value ⁼ subject_key
676 if (NULL == subject_key)
677 { 585 {
678 fprintf (stderr, "Missing option -subject for operation 'create'.'\n"); 586 fprintf (stderr, "Missing option -subject for operation 'create'.'\n");
679 GNUNET_SCHEDULER_shutdown (); 587 GNUNET_SCHEDULER_shutdown ();
@@ -682,20 +590,18 @@ store_cb (void *cls,
682 590
683 // String to value conversion for storage 591 // String to value conversion for storage
684 if (GNUNET_OK != GNUNET_GNSRECORD_string_to_value (type, 592 if (GNUNET_OK != GNUNET_GNSRECORD_string_to_value (type,
685 subject_key, 593 subject,
686 &data, 594 &data,
687 &data_size)) 595 &data_size))
688 { 596 {
689 fprintf (stderr, "Value `%s' invalid for record type `%s'\n", 597 fprintf (stderr, "Value `%s' invalid for record type `%s'\n",
690 subject_key, 598 subject,
691 typestring); 599 typestring);
692 GNUNET_SCHEDULER_shutdown (); 600 GNUNET_SCHEDULER_shutdown ();
693 return; 601 return;
694 } 602 }
695 fprintf (stderr, "Data size: `%lu'\n", data_size);
696 603
697 // Take care of expiration 604 // Take care of expiration
698
699 if (NULL == expiration) 605 if (NULL == expiration)
700 { 606 {
701 fprintf (stderr, "Missing option -e for operation 'create'\n"); 607 fprintf (stderr, "Missing option -e for operation 'create'\n");
@@ -728,13 +634,12 @@ sign_cb (void *cls,
728 const struct GNUNET_IDENTITY_Ego *ego) 634 const struct GNUNET_IDENTITY_Ego *ego)
729{ 635{
730 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; 636 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey;
731 struct GNUNET_CREDENTIAL_Credential *crd; 637 struct GNUNET_CREDENTIAL_Delegate *crd;
732 struct GNUNET_TIME_Absolute etime_abs; 638 struct GNUNET_TIME_Absolute etime_abs;
733 struct GNUNET_TIME_Relative etime_rel; 639 struct GNUNET_TIME_Relative etime_rel;
734 char *res; 640 char *res;
735 641
736 el = NULL; 642 el = NULL;
737
738 643
739 // work on expiration time 644 // work on expiration time
740 if (NULL == expiration) 645 if (NULL == expiration)
@@ -752,19 +657,34 @@ sign_cb (void *cls,
752 return; 657 return;
753 } 658 }
754 659
755 // if contains a space - split it by the first space only - assume first token entry is subject_key 660 // if contains a space - split it by the first space only - assume first entry is subject followed by attribute(s)
756 fprintf (stderr, "Start splitting\n");
757 char *space; 661 char *space;
758 int idx; 662 int idx;
759 space = strchr(subject_key, ' '); 663 char *subject_pubkey_str;
760 idx = (int)(space - subject_key); 664 char *subject_attr;
761 665
762 // TODO rename subject_key to subject 666 space = strchr(subject, ' ');
763 char *subject_pubkey_str = GNUNET_malloc(idx+1); 667 if(NULL == space)
764 GNUNET_memcpy(subject_pubkey_str, subject_key, idx); 668 {
765 subject_pubkey_str[idx] = '\0'; 669 // only contains subject key e.g. A.a <- B
766 670 subject_pubkey_str = subject;
767 fprintf(stderr, "idx: %d, str: %s\n", idx, subject_pubkey_str); 671 subject_attr = '\0';
672 } else {
673 // subject contains: key attr1.attr2.attr3...
674 // split subject into subject_pubkey_str and subject_attr
675 idx = (int)(space - subject);
676
677 subject_pubkey_str = GNUNET_malloc(idx+1);
678 GNUNET_memcpy(subject_pubkey_str, subject, idx);
679 subject_pubkey_str[idx] = '\0';
680
681 int sub_attr_len = strlen(subject) - idx - 1;
682 // +1 for the \0
683 subject_attr = GNUNET_malloc(sub_attr_len + 1);
684 // +1 to remove the space "key attr" (or whatever separator)
685 GNUNET_memcpy(subject_attr, subject + idx + 1, sub_attr_len);
686 subject_attr[sub_attr_len] = '\0';
687 }
768 688
769 // work on keys 689 // work on keys
770 privkey = GNUNET_IDENTITY_ego_get_private_key (ego); 690 privkey = GNUNET_IDENTITY_ego_get_private_key (ego);
@@ -778,18 +698,15 @@ sign_cb (void *cls,
778 return; 698 return;
779 } 699 }
780 700
781 // Sign credential / TODO not credential but delegate (new method), not only pass subject_pkey but also subject_attr 701 // Sign delegate
782 // gnunet-credential --issue --ego=registrarb --subject=$ALICE_KEY --attribute=$REG_STUD_ATTR --ttl=5m -c test_credential_lookup.conf 702 crd = GNUNET_CREDENTIAL_delegate_issue (privkey,
783 // gnunet-credential --create --ego=epub --attribute="a" --subject="B b" --where="ss" -E 60m
784 // TODO: only signs subject_pkey at the moment, also requires subject_attr (or both in subject_key)
785 crd = GNUNET_CREDENTIAL_credential_issue (privkey,
786 &subject_pkey, 703 &subject_pkey,
787 issuer_attr, 704 issuer_attr,
705 subject_attr,
788 &etime_abs); 706 &etime_abs);
789 res = GNUNET_CREDENTIAL_credential_to_string (crd); 707 res = GNUNET_CREDENTIAL_delegate_to_string (crd);
790 fprintf(stderr,"Dele: %s\n", res);
791 GNUNET_free (crd); 708 GNUNET_free (crd);
792 printf ("--ego=\"%s\" --attribute=\"%s\" --subject=\"%s\" --ttl=%s --extension=\"%s\"\n", ego_name, issuer_attr, subject_key, expiration, res); 709 printf ("%s;%s\n", expiration, res);
793 710
794 GNUNET_free_non_null (ego_name); 711 GNUNET_free_non_null (ego_name);
795 ego_name = NULL; 712 ego_name = NULL;
@@ -819,18 +736,14 @@ run (void *cls,
819 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL); 736 GNUNET_SCHEDULER_add_shutdown (&do_shutdown, NULL);
820 737
821 if (GNUNET_YES == create_is) { 738 if (GNUNET_YES == create_is) {
822 fprintf(stderr, "Starting to create issuer side...\n");
823
824 if (NULL == ego_name) { 739 if (NULL == ego_name) {
825 fprintf (stderr, "ego required\n"); 740 fprintf (stderr, "ego required\n");
826 GNUNET_SCHEDULER_shutdown (); 741 GNUNET_SCHEDULER_shutdown ();
827 return; 742 return;
828 } 743 }
829 744
745 // Lookup ego, on success call store_cb and store as ATTRIBUTE type
830 type = GNUNET_GNSRECORD_TYPE_ATTRIBUTE; 746 type = GNUNET_GNSRECORD_TYPE_ATTRIBUTE;
831 //TODO: Store normally (at issuer, for backward search)
832 // stuff from gnunet-namestore.c of namestore folder
833 fprintf (stderr, "Start: Store issuer side\n");
834 el = GNUNET_IDENTITY_ego_lookup (cfg, 747 el = GNUNET_IDENTITY_ego_lookup (cfg,
835 ego_name, 748 ego_name,
836 &store_cb, 749 &store_cb,
@@ -839,8 +752,7 @@ run (void *cls,
839 } 752 }
840 753
841 if (GNUNET_YES == create_ss) { 754 if (GNUNET_YES == create_ss) {
842 fprintf(stderr, "Starting to create subject side...\n"); 755 // check if signed parameter has been passed in cmd line call
843 // check if "credential"/signed parameter filled
844 if (NULL == extension) { 756 if (NULL == extension) {
845 fprintf (stderr, "'extension' required\n"); 757 fprintf (stderr, "'extension' required\n");
846 GNUNET_SCHEDULER_shutdown (); 758 GNUNET_SCHEDULER_shutdown ();
@@ -850,19 +762,10 @@ run (void *cls,
850 // parses all the passed parameters 762 // parses all the passed parameters
851 parse_cmdl_param(extension); 763 parse_cmdl_param(extension);
852 764
853 fprintf (stderr,"List of parsed attributes:\n"); 765 type = GNUNET_GNSRECORD_TYPE_DELEGATE;
854 fprintf (stderr,"Ego: %s\n", ego_name); 766 subject = extension;
855 fprintf (stderr,"Attribute: %s\n", issuer_attr); 767 issuer_attr = GNUNET_GNS_EMPTY_LABEL_AT;
856 fprintf (stderr,"Subject: %s\n", subject_key); 768 // Store subject side
857 fprintf (stderr,"ttl: %s\n", expiration);
858 fprintf (stderr,"Extension: %s\n", extension);
859
860 //TODO: subject key does not have to be returned, extension replaces it
861 //TODO: use own delegation type, implement string_to_value and value_to_string methods of plugin
862 //type = GNUNET_GNSRECORD_TYPE_DELEGATE;
863 type = GNUNET_GNSRECORD_TYPE_CREDENTIAL;
864 subject_key = extension;
865 fprintf (stderr, "Start: Store subject side\n");
866 el = GNUNET_IDENTITY_ego_lookup (cfg, 769 el = GNUNET_IDENTITY_ego_lookup (cfg,
867 ego_name, 770 ego_name,
868 &store_cb, 771 &store_cb,
@@ -872,26 +775,19 @@ run (void *cls,
872 } 775 }
873 776
874 if (GNUNET_YES == sign_ss) { 777 if (GNUNET_YES == sign_ss) {
875 fprintf(stderr, "Starting to sign subject side...\n");
876
877 if (NULL == ego_name) { 778 if (NULL == ego_name) {
878 fprintf (stderr, "ego required\n"); 779 fprintf (stderr, "ego required\n");
879 GNUNET_SCHEDULER_shutdown (); 780 GNUNET_SCHEDULER_shutdown ();
880 return; 781 return;
881 } 782 }
882 783 if (NULL == subject)
883 if (NULL == subject_key)
884 { 784 {
885 fprintf (stderr, "Subject public key needed\n"); 785 fprintf (stderr, "Subject public key needed\n");
886 GNUNET_SCHEDULER_shutdown (); 786 GNUNET_SCHEDULER_shutdown ();
887 return; 787 return;
888
889 } 788 }
890 789
891 //TODO: Sign like credential and return to store subject side 790 // lookup ego and call function sign_cb on success
892 //TODO: Return everything as an input for the add
893 //TODO: Idee: Gleich add machen, statt return und neues add
894 fprintf (stderr, "Start: Sign, return and subject side store\n");
895 el = GNUNET_IDENTITY_ego_lookup (cfg, 791 el = GNUNET_IDENTITY_ego_lookup (cfg,
896 ego_name, 792 ego_name,
897 &sign_cb, 793 &sign_cb,
@@ -940,7 +836,7 @@ run (void *cls,
940 836
941 } 837 }
942 838
943 if (NULL == subject_key) 839 if (NULL == subject)
944 { 840 {
945 fprintf (stderr, 841 fprintf (stderr,
946 _("Subject public key needed\n")); 842 _("Subject public key needed\n"));
@@ -949,13 +845,13 @@ run (void *cls,
949 845
950 } 846 }
951 if (GNUNET_OK != 847 if (GNUNET_OK !=
952 GNUNET_CRYPTO_ecdsa_public_key_from_string (subject_key, 848 GNUNET_CRYPTO_ecdsa_public_key_from_string (subject,
953 strlen (subject_key), 849 strlen (subject),
954 &subject_pkey)) 850 &subject_pkey))
955 { 851 {
956 fprintf (stderr, 852 fprintf (stderr,
957 _("Subject public key `%s' is not well-formed\n"), 853 _("Subject public key `%s' is not well-formed\n"),
958 subject_key); 854 subject);
959 GNUNET_SCHEDULER_shutdown (); 855 GNUNET_SCHEDULER_shutdown ();
960 return; 856 return;
961 } 857 }
@@ -1061,7 +957,6 @@ run (void *cls,
1061 _("Please specify name to lookup, subject key and issuer key!\n")); 957 _("Please specify name to lookup, subject key and issuer key!\n"));
1062 GNUNET_SCHEDULER_shutdown (); 958 GNUNET_SCHEDULER_shutdown ();
1063 } 959 }
1064 fprintf (stderr, "In the end it doesnt even shutdown\n");
1065 return; 960 return;
1066} 961}
1067 962
@@ -1088,8 +983,8 @@ main (int argc, char *const *argv)
1088 GNUNET_GETOPT_option_string ('s', 983 GNUNET_GETOPT_option_string ('s',
1089 "subject", 984 "subject",
1090 "PKEY", 985 "PKEY",
1091 gettext_noop ("The public key of the subject to lookup the credential for"), 986 gettext_noop ("The public key of the subject to lookup the credential for, or for issuer side storage: subject and its attributes"),
1092 &subject_key), 987 &subject),
1093 GNUNET_GETOPT_option_string ('b', 988 GNUNET_GETOPT_option_string ('b',
1094 "credential", 989 "credential",
1095 "CRED", 990 "CRED",
@@ -1103,7 +998,7 @@ main (int argc, char *const *argv)
1103 GNUNET_GETOPT_option_string ('e', 998 GNUNET_GETOPT_option_string ('e',
1104 "ego", 999 "ego",
1105 "EGO", 1000 "EGO",
1106 gettext_noop ("The ego to use"), 1001 gettext_noop ("The ego/zone name to use"),
1107 &ego_name), 1002 &ego_name),
1108 GNUNET_GETOPT_option_string ('a', 1003 GNUNET_GETOPT_option_string ('a',
1109 "attribute", 1004 "attribute",
@@ -1119,10 +1014,9 @@ main (int argc, char *const *argv)
1119 "collect", 1014 "collect",
1120 gettext_noop ("collect credentials"), 1015 gettext_noop ("collect credentials"),
1121 &collect), 1016 &collect),
1122
1123 GNUNET_GETOPT_option_flag ('U', 1017 GNUNET_GETOPT_option_flag ('U',
1124 "createIssuerSide", 1018 "createIssuerSide",
1125 gettext_noop ("TODO: rename create to --issue, Create and issue a credential issuer side."), 1019 gettext_noop ("Create and issue a credential issuer side."),
1126 &create_is), 1020 &create_is),
1127 GNUNET_GETOPT_option_flag ('C', 1021 GNUNET_GETOPT_option_flag ('C',
1128 "createSubjectSide", 1022 "createSubjectSide",
@@ -1132,14 +1026,10 @@ main (int argc, char *const *argv)
1132 "signSubjectSide", 1026 "signSubjectSide",
1133 gettext_noop ("Create, sign and return a credential subject side."), 1027 gettext_noop ("Create, sign and return a credential subject side."),
1134 &sign_ss), 1028 &sign_ss),
1135 GNUNET_GETOPT_option_flag ('A',
1136 "add",
1137 gettext_noop ("Add credential to the namestore of an ego"),
1138 &add_iss),
1139 GNUNET_GETOPT_option_string ('x', 1029 GNUNET_GETOPT_option_string ('x',
1140 "extension", 1030 "extension",
1141 "EXT", 1031 "EXT",
1142 gettext_noop ("Signed issue credentials"), 1032 gettext_noop ("Signed credentials that should be issued to a zone/ego"),
1143 &extension), 1033 &extension),
1144 GNUNET_GETOPT_OPTION_END 1034 GNUNET_GETOPT_OPTION_END
1145 }; 1035 };