diff options
Diffstat (limited to 'src/abd/gnunet-abd.c')
-rw-r--r-- | src/abd/gnunet-abd.c | 58 |
1 files changed, 20 insertions, 38 deletions
diff --git a/src/abd/gnunet-abd.c b/src/abd/gnunet-abd.c index b1fb767e3..17671273c 100644 --- a/src/abd/gnunet-abd.c +++ b/src/abd/gnunet-abd.c | |||
@@ -43,7 +43,7 @@ static struct GNUNET_NAMESTORE_Handle *ns; | |||
43 | /** | 43 | /** |
44 | * Private key for the our zone. | 44 | * Private key for the our zone. |
45 | */ | 45 | */ |
46 | static struct GNUNET_CRYPTO_EcdsaPrivateKey zone_pkey; | 46 | static struct GNUNET_IDENTITY_PrivateKey zone_pkey; |
47 | 47 | ||
48 | /** | 48 | /** |
49 | * EgoLookup | 49 | * EgoLookup |
@@ -98,12 +98,12 @@ static char *expiration; | |||
98 | /** | 98 | /** |
99 | * Subject key | 99 | * Subject key |
100 | */ | 100 | */ |
101 | struct GNUNET_CRYPTO_EcdsaPublicKey subject_pkey; | 101 | struct GNUNET_IDENTITY_PublicKey subject_pkey; |
102 | 102 | ||
103 | /** | 103 | /** |
104 | * Issuer key | 104 | * Issuer key |
105 | */ | 105 | */ |
106 | struct GNUNET_CRYPTO_EcdsaPublicKey issuer_pkey; | 106 | struct GNUNET_IDENTITY_PublicKey issuer_pkey; |
107 | 107 | ||
108 | 108 | ||
109 | /** | 109 | /** |
@@ -206,11 +206,6 @@ static uint64_t etime; | |||
206 | static int etime_is_rel = GNUNET_SYSERR; | 206 | static int etime_is_rel = GNUNET_SYSERR; |
207 | 207 | ||
208 | /** | 208 | /** |
209 | * Fixed size of the public/private keys | ||
210 | */ | ||
211 | static const int key_length = 52; | ||
212 | |||
213 | /** | ||
214 | * Record label for storing delegations | 209 | * Record label for storing delegations |
215 | */ | 210 | */ |
216 | static char *record_label; | 211 | static char *record_label; |
@@ -282,9 +277,9 @@ handle_intermediate_result (void *cls, | |||
282 | 277 | ||
283 | printf ("%s Intermediate result: %s.%s <- %s.%s\n", | 278 | printf ("%s Intermediate result: %s.%s <- %s.%s\n", |
284 | prefix, | 279 | prefix, |
285 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&dd->issuer_key), | 280 | GNUNET_IDENTITY_public_key_to_string (&dd->issuer_key), |
286 | dd->issuer_attribute, | 281 | dd->issuer_attribute, |
287 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&dd->subject_key), | 282 | GNUNET_IDENTITY_public_key_to_string (&dd->subject_key), |
288 | dd->subject_attribute); | 283 | dd->subject_attribute); |
289 | } | 284 | } |
290 | 285 | ||
@@ -337,8 +332,8 @@ handle_verify_result (void *cls, | |||
337 | printf ("Delegation Chain:\n"); | 332 | printf ("Delegation Chain:\n"); |
338 | for (i = 0; i < d_count; i++) | 333 | for (i = 0; i < d_count; i++) |
339 | { | 334 | { |
340 | iss_key = GNUNET_CRYPTO_ecdsa_public_key_to_string (&dc[i].issuer_key); | 335 | iss_key = GNUNET_IDENTITY_public_key_to_string (&dc[i].issuer_key); |
341 | sub_key = GNUNET_CRYPTO_ecdsa_public_key_to_string (&dc[i].subject_key); | 336 | sub_key = GNUNET_IDENTITY_public_key_to_string (&dc[i].subject_key); |
342 | 337 | ||
343 | if (0 != dc[i].subject_attribute_len) | 338 | if (0 != dc[i].subject_attribute_len) |
344 | { | 339 | { |
@@ -363,8 +358,8 @@ handle_verify_result (void *cls, | |||
363 | printf ("\nDelegate(s):\n"); | 358 | printf ("\nDelegate(s):\n"); |
364 | for (i = 0; i < c_count; i++) | 359 | for (i = 0; i < c_count; i++) |
365 | { | 360 | { |
366 | iss_key = GNUNET_CRYPTO_ecdsa_public_key_to_string (&dele[i].issuer_key); | 361 | iss_key = GNUNET_IDENTITY_public_key_to_string (&dele[i].issuer_key); |
367 | sub_key = GNUNET_CRYPTO_ecdsa_public_key_to_string (&dele[i].subject_key); | 362 | sub_key = GNUNET_IDENTITY_public_key_to_string (&dele[i].subject_key); |
368 | printf ("%s.%s <- %s\n", iss_key, dele[i].issuer_attribute, sub_key); | 363 | printf ("%s.%s <- %s\n", iss_key, dele[i].issuer_attribute, sub_key); |
369 | GNUNET_free (iss_key); | 364 | GNUNET_free (iss_key); |
370 | GNUNET_free (sub_key); | 365 | GNUNET_free (sub_key); |
@@ -386,7 +381,7 @@ handle_verify_result (void *cls, | |||
386 | static void | 381 | static void |
387 | identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) | 382 | identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) |
388 | { | 383 | { |
389 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; | 384 | const struct GNUNET_IDENTITY_PrivateKey *privkey; |
390 | 385 | ||
391 | el = NULL; | 386 | el = NULL; |
392 | if (NULL == ego) | 387 | if (NULL == ego) |
@@ -405,8 +400,7 @@ identity_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) | |||
405 | { | 400 | { |
406 | 401 | ||
407 | if (GNUNET_OK != | 402 | if (GNUNET_OK != |
408 | GNUNET_CRYPTO_ecdsa_public_key_from_string (issuer_key, | 403 | GNUNET_IDENTITY_public_key_from_string (issuer_key, |
409 | strlen (issuer_key), | ||
410 | &issuer_pkey)) | 404 | &issuer_pkey)) |
411 | { | 405 | { |
412 | fprintf (stderr, | 406 | fprintf (stderr, |
@@ -507,7 +501,7 @@ add_continuation (void *cls, int32_t success, const char *emsg) | |||
507 | 501 | ||
508 | static void | 502 | static void |
509 | get_existing_record (void *cls, | 503 | get_existing_record (void *cls, |
510 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *zone_key, | 504 | const struct GNUNET_IDENTITY_PrivateKey *zone_key, |
511 | const char *rec_name, | 505 | const char *rec_name, |
512 | unsigned int rd_count, | 506 | unsigned int rd_count, |
513 | const struct GNUNET_GNSRECORD_Data *rd) | 507 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -573,13 +567,13 @@ store_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) | |||
573 | 567 | ||
574 | // Get import subject public key string | 568 | // Get import subject public key string |
575 | char *subject_pubkey_str = | 569 | char *subject_pubkey_str = |
576 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&cred->subject_key); | 570 | GNUNET_IDENTITY_public_key_to_string (&cred->subject_key); |
577 | 571 | ||
578 | // Get zone public key string | 572 | // Get zone public key string |
579 | struct GNUNET_CRYPTO_EcdsaPublicKey zone_pubkey; | 573 | struct GNUNET_IDENTITY_PublicKey zone_pubkey; |
580 | GNUNET_IDENTITY_ego_get_public_key (ego, &zone_pubkey); | 574 | GNUNET_IDENTITY_ego_get_public_key (ego, &zone_pubkey); |
581 | char *zone_pubkey_str = | 575 | char *zone_pubkey_str = |
582 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&zone_pubkey); | 576 | GNUNET_IDENTITY_public_key_to_string (&zone_pubkey); |
583 | 577 | ||
584 | // Check if the subject key in the signed import matches the zone's key it is issued to | 578 | // Check if the subject key in the signed import matches the zone's key it is issued to |
585 | if (strcmp (zone_pubkey_str, subject_pubkey_str) != 0) | 579 | if (strcmp (zone_pubkey_str, subject_pubkey_str) != 0) |
@@ -655,7 +649,7 @@ store_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) | |||
655 | static void | 649 | static void |
656 | sign_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) | 650 | sign_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) |
657 | { | 651 | { |
658 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey; | 652 | const struct GNUNET_IDENTITY_PrivateKey *privkey; |
659 | struct GNUNET_ABD_Delegate *dele; | 653 | struct GNUNET_ABD_Delegate *dele; |
660 | struct GNUNET_TIME_Absolute etime_abs; | 654 | struct GNUNET_TIME_Absolute etime_abs; |
661 | char *res; | 655 | char *res; |
@@ -686,16 +680,7 @@ sign_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) | |||
686 | 680 | ||
687 | // Subject Public Key | 681 | // Subject Public Key |
688 | token = strtok (subject, " "); | 682 | token = strtok (subject, " "); |
689 | if (key_length == strlen (token)) | 683 | subject_pubkey_str = token; |
690 | { | ||
691 | subject_pubkey_str = token; | ||
692 | } | ||
693 | else | ||
694 | { | ||
695 | fprintf (stderr, "Key error, wrong length: %ld!\n", strlen (token)); | ||
696 | GNUNET_SCHEDULER_shutdown (); | ||
697 | return; | ||
698 | } | ||
699 | // Subject Attribute(s) | 684 | // Subject Attribute(s) |
700 | token = strtok (NULL, " "); | 685 | token = strtok (NULL, " "); |
701 | if (NULL != token) | 686 | if (NULL != token) |
@@ -707,8 +692,7 @@ sign_cb (void *cls, struct GNUNET_IDENTITY_Ego *ego) | |||
707 | privkey = GNUNET_IDENTITY_ego_get_private_key (ego); | 692 | privkey = GNUNET_IDENTITY_ego_get_private_key (ego); |
708 | 693 | ||
709 | if (GNUNET_OK != | 694 | if (GNUNET_OK != |
710 | GNUNET_CRYPTO_ecdsa_public_key_from_string (subject_pubkey_str, | 695 | GNUNET_IDENTITY_public_key_from_string (subject_pubkey_str, |
711 | strlen (subject_pubkey_str), | ||
712 | &subject_pkey)) | 696 | &subject_pkey)) |
713 | { | 697 | { |
714 | fprintf (stderr, | 698 | fprintf (stderr, |
@@ -873,8 +857,7 @@ run (void *cls, | |||
873 | GNUNET_SCHEDULER_shutdown (); | 857 | GNUNET_SCHEDULER_shutdown (); |
874 | return; | 858 | return; |
875 | } | 859 | } |
876 | if (GNUNET_OK != GNUNET_CRYPTO_ecdsa_public_key_from_string (subject, | 860 | if (GNUNET_OK != GNUNET_IDENTITY_public_key_from_string (subject, |
877 | strlen (subject), | ||
878 | &subject_pkey)) | 861 | &subject_pkey)) |
879 | { | 862 | { |
880 | fprintf (stderr, | 863 | fprintf (stderr, |
@@ -893,8 +876,7 @@ run (void *cls, | |||
893 | return; | 876 | return; |
894 | } | 877 | } |
895 | if (GNUNET_OK != | 878 | if (GNUNET_OK != |
896 | GNUNET_CRYPTO_ecdsa_public_key_from_string (issuer_key, | 879 | GNUNET_IDENTITY_public_key_from_string (issuer_key, |
897 | strlen (issuer_key), | ||
898 | &issuer_pkey)) | 880 | &issuer_pkey)) |
899 | { | 881 | { |
900 | fprintf (stderr, | 882 | fprintf (stderr, |