aboutsummaryrefslogtreecommitdiff
path: root/src/identity/identity_api.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/identity/identity_api.c')
-rw-r--r--src/identity/identity_api.c7
1 files changed, 6 insertions, 1 deletions
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c
index c2fcc5075..5d17ac5d5 100644
--- a/src/identity/identity_api.c
+++ b/src/identity/identity_api.c
@@ -715,6 +715,7 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *h,
715 * 715 *
716 * @param h identity service to use 716 * @param h identity service to use
717 * @param name desired name 717 * @param name desired name
718 * @param privkey desired private key or NULL to create one
718 * @param cont function to call with the result (will only be called once) 719 * @param cont function to call with the result (will only be called once)
719 * @param cont_cls closure for @a cont 720 * @param cont_cls closure for @a cont
720 * @return handle to abort the operation 721 * @return handle to abort the operation
@@ -722,6 +723,7 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *h,
722struct GNUNET_IDENTITY_Operation * 723struct GNUNET_IDENTITY_Operation *
723GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h, 724GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h,
724 const char *name, 725 const char *name,
726 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey,
725 GNUNET_IDENTITY_CreateContinuation cont, 727 GNUNET_IDENTITY_CreateContinuation cont,
726 void *cont_cls) 728 void *cont_cls)
727{ 729{
@@ -746,7 +748,10 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h,
746 env = GNUNET_MQ_msg_extra (crm, slen, GNUNET_MESSAGE_TYPE_IDENTITY_CREATE); 748 env = GNUNET_MQ_msg_extra (crm, slen, GNUNET_MESSAGE_TYPE_IDENTITY_CREATE);
747 crm->name_len = htons (slen); 749 crm->name_len = htons (slen);
748 crm->reserved = htons (0); 750 crm->reserved = htons (0);
749 GNUNET_CRYPTO_ecdsa_key_create (&crm->private_key); 751 if (NULL == privkey)
752 GNUNET_CRYPTO_ecdsa_key_create (&crm->private_key);
753 else
754 crm->private_key = *privkey;
750 op->pk = crm->private_key; 755 op->pk = crm->private_key;
751 GNUNET_memcpy (&crm[1], name, slen); 756 GNUNET_memcpy (&crm[1], name, slen);
752 GNUNET_MQ_send (h->mq, env); 757 GNUNET_MQ_send (h->mq, env);