diff options
Diffstat (limited to 'src/identity/gnunet-identity.c')
-rw-r--r-- | src/identity/gnunet-identity.c | 42 |
1 files changed, 37 insertions, 5 deletions
diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c index fd73048c4..cf44afd1f 100644 --- a/src/identity/gnunet-identity.c +++ b/src/identity/gnunet-identity.c | |||
@@ -76,6 +76,11 @@ static char *create_ego; | |||
76 | static char *delete_ego; | 76 | static char *delete_ego; |
77 | 77 | ||
78 | /** | 78 | /** |
79 | * -P option | ||
80 | */ | ||
81 | static char *privkey_ego; | ||
82 | |||
83 | /** | ||
79 | * -s option. | 84 | * -s option. |
80 | */ | 85 | */ |
81 | static char *set_ego; | 86 | static char *set_ego; |
@@ -101,6 +106,11 @@ static struct GNUNET_IDENTITY_Operation *create_op; | |||
101 | static struct GNUNET_IDENTITY_Operation *delete_op; | 106 | static struct GNUNET_IDENTITY_Operation *delete_op; |
102 | 107 | ||
103 | /** | 108 | /** |
109 | * Private key from command line option, or NULL. | ||
110 | */ | ||
111 | struct GNUNET_CRYPTO_EcdsaPrivateKey pk; | ||
112 | |||
113 | /** | ||
104 | * Value to return from #main(). | 114 | * Value to return from #main(). |
105 | */ | 115 | */ |
106 | static int global_ret; | 116 | static int global_ret; |
@@ -390,11 +400,28 @@ run (void *cls, | |||
390 | &delete_finished, | 400 | &delete_finished, |
391 | &delete_op); | 401 | &delete_op); |
392 | if (NULL != create_ego) | 402 | if (NULL != create_ego) |
393 | create_op = | 403 | { |
394 | GNUNET_IDENTITY_create (sh, | 404 | if (NULL != privkey_ego) |
395 | create_ego, | 405 | { |
396 | &create_finished, | 406 | GNUNET_STRINGS_string_to_data (privkey_ego, |
397 | &create_op); | 407 | strlen (privkey_ego), |
408 | &pk, | ||
409 | sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey)); | ||
410 | create_op = | ||
411 | GNUNET_IDENTITY_create (sh, | ||
412 | create_ego, | ||
413 | &pk, | ||
414 | &create_finished, | ||
415 | &create_op); | ||
416 | } | ||
417 | else | ||
418 | create_op = | ||
419 | GNUNET_IDENTITY_create (sh, | ||
420 | create_ego, | ||
421 | NULL, | ||
422 | &create_finished, | ||
423 | &create_op); | ||
424 | } | ||
398 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, | 425 | GNUNET_SCHEDULER_add_shutdown (&shutdown_task, |
399 | NULL); | 426 | NULL); |
400 | test_finished (); | 427 | test_finished (); |
@@ -422,6 +449,11 @@ main (int argc, char *const *argv) | |||
422 | "NAME", | 449 | "NAME", |
423 | gettext_noop ("delete ego NAME "), | 450 | gettext_noop ("delete ego NAME "), |
424 | &delete_ego), | 451 | &delete_ego), |
452 | GNUNET_GETOPT_option_string ('P', | ||
453 | "privkey", | ||
454 | "PRIVATE_KEY", | ||
455 | gettext_noop ("set the private key for the identity to PRIVATE_KEY (use together with -C)"), | ||
456 | &privkey_ego), | ||
425 | GNUNET_GETOPT_option_flag ('d', | 457 | GNUNET_GETOPT_option_flag ('d', |
426 | "display", | 458 | "display", |
427 | gettext_noop ("display all egos"), | 459 | gettext_noop ("display all egos"), |