aboutsummaryrefslogtreecommitdiff
path: root/src/identity
diff options
context:
space:
mode:
authorTheJackiMonster <thejackimonster@gmail.com>2020-10-01 21:13:43 +0200
committerTheJackiMonster <thejackimonster@gmail.com>2020-11-12 16:57:45 +0100
commit8bf864c25bda97c1448b709a76a168834753ff86 (patch)
tree6ffccc18a3c112e035235c596006f8b13aca1be7 /src/identity
parent8fd7531e5841c9d9f80f821a3490a05934fee933 (diff)
downloadgnunet-8bf864c25bda97c1448b709a76a168834753ff86.tar.gz
gnunet-8bf864c25bda97c1448b709a76a168834753ff86.zip
adding the messenger service and its client-side library
Signed-off-by: TheJackiMonster <thejackimonster@gmail.com>
Diffstat (limited to 'src/identity')
-rw-r--r--src/identity/gnunet-identity.c45
-rw-r--r--src/identity/gnunet-service-identity.c77
-rw-r--r--src/identity/identity.h81
-rw-r--r--src/identity/identity_api.c391
-rw-r--r--src/identity/identity_api_lookup.c4
-rw-r--r--src/identity/plugin_rest_identity.c23
-rw-r--r--src/identity/test_identity.c8
-rw-r--r--src/identity/test_identity_defaults.c8
8 files changed, 538 insertions, 99 deletions
diff --git a/src/identity/gnunet-identity.c b/src/identity/gnunet-identity.c
index d0f5546f3..a01cd1ed7 100644
--- a/src/identity/gnunet-identity.c
+++ b/src/identity/gnunet-identity.c
@@ -66,6 +66,11 @@ static unsigned int verbose;
66static int quiet; 66static int quiet;
67 67
68/** 68/**
69 * Was "eddsa" specified?
70 */
71static int type_eddsa;
72
73/**
69 * -C option 74 * -C option
70 */ 75 */
71static char *create_ego; 76static char *create_ego;
@@ -108,7 +113,7 @@ static struct GNUNET_IDENTITY_Operation *delete_op;
108/** 113/**
109 * Private key from command line option, or NULL. 114 * Private key from command line option, or NULL.
110 */ 115 */
111struct GNUNET_CRYPTO_EcdsaPrivateKey pk; 116struct GNUNET_IDENTITY_PrivateKey pk;
112 117
113/** 118/**
114 * Value to return from #main(). 119 * Value to return from #main().
@@ -197,7 +202,7 @@ delete_finished (void *cls,
197 */ 202 */
198static void 203static void
199create_finished (void *cls, 204create_finished (void *cls,
200 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, 205 const struct GNUNET_IDENTITY_PrivateKey *pk,
201 const char *emsg) 206 const char *emsg)
202{ 207{
203 struct GNUNET_IDENTITY_Operation **op = cls; 208 struct GNUNET_IDENTITY_Operation **op = cls;
@@ -212,16 +217,16 @@ create_finished (void *cls,
212 } 217 }
213 else if (verbose) 218 else if (verbose)
214 { 219 {
215 struct GNUNET_CRYPTO_EcdsaPublicKey pub; 220 struct GNUNET_IDENTITY_PublicKey pub;
216 char *pubs; 221 char *pubs;
217 222
218 GNUNET_CRYPTO_ecdsa_key_get_public (pk, &pub); 223 GNUNET_IDENTITY_key_get_public (pk, &pub);
219 pubs = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pub); 224 pubs = GNUNET_IDENTITY_public_key_to_string (&pub);
220 if (private_keys) 225 if (private_keys)
221 { 226 {
222 char *privs; 227 char *privs;
223 228
224 privs = GNUNET_CRYPTO_ecdsa_private_key_to_string (pk); 229 privs = GNUNET_IDENTITY_private_key_to_string (pk);
225 fprintf (stdout, "%s - %s\n", pubs, privs); 230 fprintf (stdout, "%s - %s\n", pubs, privs);
226 GNUNET_free (privs); 231 GNUNET_free (privs);
227 } 232 }
@@ -293,7 +298,7 @@ print_ego (void *cls,
293 void **ctx, 298 void **ctx,
294 const char *identifier) 299 const char *identifier)
295{ 300{
296 struct GNUNET_CRYPTO_EcdsaPublicKey pk; 301 struct GNUNET_IDENTITY_PublicKey pk;
297 char *s; 302 char *s;
298 char *privs; 303 char *privs;
299 304
@@ -342,8 +347,8 @@ print_ego (void *cls,
342 set_ego)) ) 347 set_ego)) )
343 return; 348 return;
344 GNUNET_IDENTITY_ego_get_public_key (ego, &pk); 349 GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
345 s = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); 350 s = GNUNET_IDENTITY_public_key_to_string (&pk);
346 privs = GNUNET_CRYPTO_ecdsa_private_key_to_string ( 351 privs = GNUNET_IDENTITY_private_key_to_string (
347 GNUNET_IDENTITY_ego_get_private_key (ego)); 352 GNUNET_IDENTITY_ego_get_private_key (ego));
348 if ((monitor) || (NULL != identifier)) 353 if ((monitor) || (NULL != identifier))
349 { 354 {
@@ -357,9 +362,16 @@ print_ego (void *cls,
357 else 362 else
358 { 363 {
359 if (private_keys) 364 if (private_keys)
360 fprintf (stdout, "%s - %s - %s\n", identifier, s, privs); 365 fprintf (stdout, "%s - %s - %s - %s\n",
366 identifier, s, privs,
367 (ntohl (pk.type) == GNUNET_IDENTITY_TYPE_ECDSA) ?
368 "ECDSA" : "EdDSA");
361 else 369 else
362 fprintf (stdout, "%s - %s\n", identifier, s); 370 fprintf (stdout, "%s - %s - %s\n",
371 identifier, s,
372 (ntohl (pk.type) == GNUNET_IDENTITY_TYPE_ECDSA) ?
373 "ECDSA" : "EdDSA");
374
363 } 375 }
364 } 376 }
365 GNUNET_free (privs); 377 GNUNET_free (privs);
@@ -407,11 +419,12 @@ run (void *cls,
407 strlen (privkey_ego), 419 strlen (privkey_ego),
408 &pk, 420 &pk,
409 sizeof(struct 421 sizeof(struct
410 GNUNET_CRYPTO_EcdsaPrivateKey)); 422 GNUNET_IDENTITY_PrivateKey));
411 create_op = 423 create_op =
412 GNUNET_IDENTITY_create (sh, 424 GNUNET_IDENTITY_create (sh,
413 create_ego, 425 create_ego,
414 &pk, 426 &pk,
427 0, // Ignored
415 &create_finished, 428 &create_finished,
416 &create_op); 429 &create_op);
417 } 430 }
@@ -420,6 +433,9 @@ run (void *cls,
420 GNUNET_IDENTITY_create (sh, 433 GNUNET_IDENTITY_create (sh,
421 create_ego, 434 create_ego,
422 NULL, 435 NULL,
436 (type_eddsa) ?
437 GNUNET_IDENTITY_TYPE_EDDSA :
438 GNUNET_IDENTITY_TYPE_ECDSA,
423 &create_finished, 439 &create_finished,
424 &create_op); 440 &create_op);
425 } 441 }
@@ -456,6 +472,11 @@ main (int argc, char *const *argv)
456 gettext_noop ( 472 gettext_noop (
457 "set the private key for the identity to PRIVATE_KEY (use together with -C)"), 473 "set the private key for the identity to PRIVATE_KEY (use together with -C)"),
458 &privkey_ego), 474 &privkey_ego),
475 GNUNET_GETOPT_option_flag ('X',
476 "eddsa",
477 gettext_noop (
478 "generate an EdDSA identity. (use together with -C) EXPERIMENTAL"),
479 &type_eddsa),
459 GNUNET_GETOPT_option_flag ('d', 480 GNUNET_GETOPT_option_flag ('d',
460 "display", 481 "display",
461 gettext_noop ("display all egos"), 482 gettext_noop ("display all egos"),
diff --git a/src/identity/gnunet-service-identity.c b/src/identity/gnunet-service-identity.c
index bdacf3ba0..6cdb1c2f7 100644
--- a/src/identity/gnunet-service-identity.c
+++ b/src/identity/gnunet-service-identity.c
@@ -57,7 +57,7 @@ struct Ego
57 /** 57 /**
58 * Private key of the ego. 58 * Private key of the ego.
59 */ 59 */
60 struct GNUNET_CRYPTO_EcdsaPrivateKey pk; 60 struct GNUNET_IDENTITY_PrivateKey pk;
61 61
62 /** 62 /**
63 * String identifier for the ego. 63 * String identifier for the ego.
@@ -538,8 +538,8 @@ handle_get_default_message (void *cls,
538 * @return 0 if the keys are equal 538 * @return 0 if the keys are equal
539 */ 539 */
540static int 540static int
541key_cmp (const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk1, 541key_cmp (const struct GNUNET_IDENTITY_PrivateKey *pk1,
542 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk2) 542 const struct GNUNET_IDENTITY_PrivateKey *pk2)
543{ 543{
544 return GNUNET_memcmp (pk1, pk2); 544 return GNUNET_memcmp (pk1, pk2);
545} 545}
@@ -738,10 +738,10 @@ handle_create_message (void *cls,
738 send_result_code (client, 0, NULL); 738 send_result_code (client, 0, NULL);
739 fn = get_ego_filename (ego); 739 fn = get_ego_filename (ego);
740 (void) GNUNET_DISK_directory_create_for_file (fn); 740 (void) GNUNET_DISK_directory_create_for_file (fn);
741 if (sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey) != 741 if (sizeof(struct GNUNET_IDENTITY_PrivateKey) !=
742 GNUNET_DISK_fn_write (fn, 742 GNUNET_DISK_fn_write (fn,
743 &crm->private_key, 743 &crm->private_key,
744 sizeof(struct GNUNET_CRYPTO_EcdsaPrivateKey), 744 sizeof(struct GNUNET_IDENTITY_PrivateKey),
745 GNUNET_DISK_PERM_USER_READ 745 GNUNET_DISK_PERM_USER_READ
746 | GNUNET_DISK_PERM_USER_WRITE)) 746 | GNUNET_DISK_PERM_USER_WRITE))
747 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", fn); 747 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_ERROR, "write", fn);
@@ -1038,6 +1038,67 @@ handle_delete_message (void *cls, const struct DeleteMessage *dm)
1038} 1038}
1039 1039
1040 1040
1041static int
1042read_from_file (const char *filename,
1043 void *buf,
1044 size_t buf_size)
1045{
1046 int fd;
1047 struct stat sb;
1048
1049 fd = open (filename,
1050 O_RDONLY);
1051 if (-1 == fd)
1052 {
1053 memset (buf,
1054 0,
1055 buf_size);
1056 return GNUNET_SYSERR;
1057 }
1058 if (0 != fstat (fd,
1059 &sb))
1060 {
1061 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
1062 "stat",
1063 filename);
1064 GNUNET_assert (0 == close (fd));
1065 memset (buf,
1066 0,
1067 buf_size);
1068 return GNUNET_SYSERR;
1069 }
1070 if (sb.st_size != buf_size)
1071 {
1072 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
1073 "File `%s' has wrong size (%llu), expected %llu bytes\n",
1074 filename,
1075 (unsigned long long) sb.st_size,
1076 (unsigned long long) buf_size);
1077 GNUNET_assert (0 == close (fd));
1078 memset (buf,
1079 0,
1080 buf_size);
1081 return GNUNET_SYSERR;
1082 }
1083 if (buf_size !=
1084 read (fd,
1085 buf,
1086 buf_size))
1087 {
1088 GNUNET_log_strerror_file (GNUNET_ERROR_TYPE_WARNING,
1089 "read",
1090 filename);
1091 GNUNET_assert (0 == close (fd));
1092 memset (buf,
1093 0,
1094 buf_size);
1095 return GNUNET_SYSERR;
1096 }
1097 GNUNET_assert (0 == close (fd));
1098 return GNUNET_OK;
1099}
1100
1101
1041/** 1102/**
1042 * Process the given file from the "EGODIR". Parses the file 1103 * Process the given file from the "EGODIR". Parses the file
1043 * and creates the respective 'struct Ego' in memory. 1104 * and creates the respective 'struct Ego' in memory.
@@ -1063,9 +1124,9 @@ process_ego_file (void *cls,
1063 } 1124 }
1064 ego = GNUNET_new (struct Ego); 1125 ego = GNUNET_new (struct Ego);
1065 if (GNUNET_OK != 1126 if (GNUNET_OK !=
1066 GNUNET_CRYPTO_ecdsa_key_from_file (filename, 1127 read_from_file (filename,
1067 GNUNET_NO, 1128 &ego->pk,
1068 &ego->pk)) 1129 sizeof (ego->pk)))
1069 { 1130 {
1070 GNUNET_free (ego); 1131 GNUNET_free (ego);
1071 GNUNET_log (GNUNET_ERROR_TYPE_WARNING, 1132 GNUNET_log (GNUNET_ERROR_TYPE_WARNING,
diff --git a/src/identity/identity.h b/src/identity/identity.h
index ef638fa36..11c5883bc 100644
--- a/src/identity/identity.h
+++ b/src/identity/identity.h
@@ -30,6 +30,44 @@
30 30
31#include "gnunet_common.h" 31#include "gnunet_common.h"
32 32
33/**
34 * Handle for an ego.
35 */
36struct GNUNET_IDENTITY_Ego
37{
38 /**
39 * Hash of the private key of this ego.
40 */
41 struct GNUNET_HashCode id;
42
43 /**
44 * The identity key pair
45 */
46 struct GNUNET_IDENTITY_PublicKey pub;
47
48 /**
49 * The identity key pair
50 */
51 struct GNUNET_IDENTITY_PrivateKey pk;
52
53 /**
54 * Current name associated with this ego.
55 */
56 char *name;
57
58 /**
59 * Client context associated with this ego.
60 */
61 void *ctx;
62
63 /**
64 * Set to true once @e pub was initialized
65 */
66 bool pub_initialized;
67};
68
69
70
33 71
34GNUNET_NETWORK_STRUCT_BEGIN 72GNUNET_NETWORK_STRUCT_BEGIN
35 73
@@ -95,7 +133,7 @@ struct UpdateMessage
95 /** 133 /**
96 * The private key 134 * The private key
97 */ 135 */
98 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; 136 struct GNUNET_IDENTITY_PrivateKey private_key;
99 137
100 /* followed by 0-terminated ego name */ 138 /* followed by 0-terminated ego name */
101}; 139};
@@ -151,7 +189,7 @@ struct SetDefaultMessage
151 /** 189 /**
152 * The private key 190 * The private key
153 */ 191 */
154 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; 192 struct GNUNET_IDENTITY_PrivateKey private_key;
155 193
156 /* followed by 0-terminated service name */ 194 /* followed by 0-terminated service name */
157}; 195};
@@ -181,7 +219,7 @@ struct CreateRequestMessage
181 /** 219 /**
182 * The private key 220 * The private key
183 */ 221 */
184 struct GNUNET_CRYPTO_EcdsaPrivateKey private_key; 222 struct GNUNET_IDENTITY_PrivateKey private_key;
185 223
186 /* followed by 0-terminated identity name */ 224 /* followed by 0-terminated identity name */
187}; 225};
@@ -239,42 +277,5 @@ struct DeleteMessage
239 277
240GNUNET_NETWORK_STRUCT_END 278GNUNET_NETWORK_STRUCT_END
241 279
242/**
243 * Handle for an ego.
244 */
245struct GNUNET_IDENTITY_Ego
246{
247 /**
248 * Hash of the private key of this ego.
249 */
250 struct GNUNET_HashCode id;
251
252 /**
253 * Private key associated with this ego.
254 */
255 struct GNUNET_CRYPTO_EcdsaPrivateKey pk;
256
257 /**
258 * Public key associated with this ego. Initialized on demand.
259 * Always use #GNUNET_IDENTITY_ego_get_public_key() to obtain.
260 */
261 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
262
263 /**
264 * Current name associated with this ego.
265 */
266 char *name;
267
268 /**
269 * Client context associated with this ego.
270 */
271 void *ctx;
272
273 /**
274 * Set to true once @e pub was initialized
275 */
276 bool pub_initialized;
277};
278
279 280
280#endif 281#endif
diff --git a/src/identity/identity_api.c b/src/identity/identity_api.c
index f7aca1655..64c088923 100644
--- a/src/identity/identity_api.c
+++ b/src/identity/identity_api.c
@@ -74,7 +74,7 @@ struct GNUNET_IDENTITY_Operation
74 /** 74 /**
75 * Private key to return to @e create_cont, or NULL. 75 * Private key to return to @e create_cont, or NULL.
76 */ 76 */
77 struct GNUNET_CRYPTO_EcdsaPrivateKey pk; 77 struct GNUNET_IDENTITY_PrivateKey pk;
78 78
79 /** 79 /**
80 * Continuation to invoke with the result of the transmission for 80 * Continuation to invoke with the result of the transmission for
@@ -157,13 +157,12 @@ GNUNET_IDENTITY_ego_get_anonymous ()
157{ 157{
158 static struct GNUNET_IDENTITY_Ego anon; 158 static struct GNUNET_IDENTITY_Ego anon;
159 static int setup; 159 static int setup;
160 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
161 160
162 if (setup) 161 if (setup)
163 return &anon; 162 return &anon;
164 anon.pk = *GNUNET_CRYPTO_ecdsa_key_get_anonymous (); 163 anon.pk.type = htonl (GNUNET_IDENTITY_TYPE_ECDSA);
165 GNUNET_CRYPTO_ecdsa_key_get_public (&anon.pk, 164 anon.pub.type = htonl (GNUNET_IDENTITY_TYPE_ECDSA);
166 &pub); 165 anon.pk.ecdsa_key = *GNUNET_CRYPTO_ecdsa_key_get_anonymous ();
167 GNUNET_CRYPTO_hash (&anon.pk, 166 GNUNET_CRYPTO_hash (&anon.pk,
168 sizeof(anon.pk), 167 sizeof(anon.pk),
169 &anon.id); 168 &anon.id);
@@ -172,6 +171,51 @@ GNUNET_IDENTITY_ego_get_anonymous ()
172} 171}
173 172
174 173
174enum GNUNET_GenericReturnValue
175GNUNET_IDENTITY_key_get_public (const struct
176 GNUNET_IDENTITY_PrivateKey *privkey,
177 struct GNUNET_IDENTITY_PublicKey *key)
178{
179 key->type = privkey->type;
180 switch (ntohl (privkey->type))
181 {
182 case GNUNET_IDENTITY_TYPE_ECDSA:
183 GNUNET_CRYPTO_ecdsa_key_get_public (&privkey->ecdsa_key,
184 &key->ecdsa_key);
185 break;
186 case GNUNET_IDENTITY_TYPE_EDDSA:
187 GNUNET_CRYPTO_eddsa_key_get_public (&privkey->eddsa_key,
188 &key->eddsa_key);
189 break;
190 default:
191 GNUNET_break (0);
192 return GNUNET_SYSERR;
193 }
194 return GNUNET_OK;
195}
196
197
198static int
199private_key_create (enum GNUNET_IDENTITY_KeyType ktype,
200 struct GNUNET_IDENTITY_PrivateKey *key)
201{
202 key->type = htonl (ktype);
203 switch (ktype)
204 {
205 case GNUNET_IDENTITY_TYPE_ECDSA:
206 GNUNET_CRYPTO_ecdsa_key_create (&key->ecdsa_key);
207 break;
208 case GNUNET_IDENTITY_TYPE_EDDSA:
209 GNUNET_CRYPTO_eddsa_key_create (&key->eddsa_key);
210 break;
211 default:
212 GNUNET_break (0);
213 return GNUNET_SYSERR;
214 }
215 return GNUNET_OK;
216}
217
218
175/** 219/**
176 * Try again to connect to the identity service. 220 * Try again to connect to the identity service.
177 * 221 *
@@ -591,7 +635,7 @@ GNUNET_IDENTITY_connect (const struct GNUNET_CONFIGURATION_Handle *cfg,
591 * @param ego the ego 635 * @param ego the ego
592 * @return associated ECC key, valid as long as the ego is valid 636 * @return associated ECC key, valid as long as the ego is valid
593 */ 637 */
594const struct GNUNET_CRYPTO_EcdsaPrivateKey * 638const struct GNUNET_IDENTITY_PrivateKey *
595GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego) 639GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego)
596{ 640{
597 return &ego->pk; 641 return &ego->pk;
@@ -606,12 +650,11 @@ GNUNET_IDENTITY_ego_get_private_key (const struct GNUNET_IDENTITY_Ego *ego)
606 */ 650 */
607void 651void
608GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego, 652GNUNET_IDENTITY_ego_get_public_key (struct GNUNET_IDENTITY_Ego *ego,
609 struct GNUNET_CRYPTO_EcdsaPublicKey *pk) 653 struct GNUNET_IDENTITY_PublicKey *pk)
610{ 654{
611 if (GNUNET_NO == ego->pub_initialized) 655 if (GNUNET_NO == ego->pub_initialized)
612 { 656 {
613 GNUNET_CRYPTO_ecdsa_key_get_public (&ego->pk, 657 GNUNET_IDENTITY_key_get_public (&ego->pk, &ego->pub);
614 &ego->pub);
615 ego->pub_initialized = GNUNET_YES; 658 ego->pub_initialized = GNUNET_YES;
616 } 659 }
617 *pk = ego->pub; 660 *pk = ego->pub;
@@ -710,20 +753,11 @@ GNUNET_IDENTITY_set (struct GNUNET_IDENTITY_Handle *h,
710} 753}
711 754
712 755
713/**
714 * Create a new identity with the given name.
715 *
716 * @param h identity service to use
717 * @param name desired name
718 * @param privkey desired private key or NULL to create one
719 * @param cont function to call with the result (will only be called once)
720 * @param cont_cls closure for @a cont
721 * @return handle to abort the operation
722 */
723struct GNUNET_IDENTITY_Operation * 756struct GNUNET_IDENTITY_Operation *
724GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h, 757GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h,
725 const char *name, 758 const char *name,
726 const struct GNUNET_CRYPTO_EcdsaPrivateKey *privkey, 759 const struct GNUNET_IDENTITY_PrivateKey *privkey,
760 enum GNUNET_IDENTITY_KeyType ktype,
727 GNUNET_IDENTITY_CreateContinuation cont, 761 GNUNET_IDENTITY_CreateContinuation cont,
728 void *cont_cls) 762 void *cont_cls)
729{ 763{
@@ -749,7 +783,10 @@ GNUNET_IDENTITY_create (struct GNUNET_IDENTITY_Handle *h,
749 crm->name_len = htons (slen); 783 crm->name_len = htons (slen);
750 crm->reserved = htons (0); 784 crm->reserved = htons (0);
751 if (NULL == privkey) 785 if (NULL == privkey)
752 GNUNET_CRYPTO_ecdsa_key_create (&crm->private_key); 786 {
787 GNUNET_assert (GNUNET_OK ==
788 private_key_create (ktype, &crm->private_key));
789 }
753 else 790 else
754 crm->private_key = *privkey; 791 crm->private_key = *privkey;
755 op->pk = crm->private_key; 792 op->pk = crm->private_key;
@@ -917,4 +954,316 @@ GNUNET_IDENTITY_disconnect (struct GNUNET_IDENTITY_Handle *h)
917} 954}
918 955
919 956
957ssize_t
958private_key_get_length (const struct GNUNET_IDENTITY_PrivateKey *key)
959{
960 switch (ntohl (key->type))
961 {
962 case GNUNET_IDENTITY_TYPE_ECDSA:
963 return sizeof (key->type) + sizeof (key->ecdsa_key);
964 break;
965 case GNUNET_IDENTITY_TYPE_EDDSA:
966 return sizeof (key->type) + sizeof (key->eddsa_key);
967 break;
968 default:
969 GNUNET_break (0);
970 }
971 return -1;
972}
973
974
975ssize_t
976GNUNET_IDENTITY_key_get_length (const struct GNUNET_IDENTITY_PublicKey *key)
977{
978 switch (ntohl (key->type))
979 {
980 case GNUNET_IDENTITY_TYPE_ECDSA:
981 return sizeof (key->type) + sizeof (key->ecdsa_key);
982 break;
983 case GNUNET_IDENTITY_TYPE_EDDSA:
984 return sizeof (key->type) + sizeof (key->eddsa_key);
985 break;
986 default:
987 GNUNET_break (0);
988 }
989 return -1;
990}
991
992
993ssize_t
994GNUNET_IDENTITY_read_key_from_buffer (struct GNUNET_IDENTITY_PublicKey *key,
995 const void*buffer,
996 size_t len)
997{
998 if (len < sizeof (key->type))
999 return -1;
1000 GNUNET_memcpy (&(key->type), buffer, sizeof (key->type));
1001 const ssize_t length = GNUNET_IDENTITY_key_get_length (key);
1002 if (len < length)
1003 return -1;
1004 if (length < 0)
1005 return -2;
1006 GNUNET_memcpy (&(key->ecdsa_key), buffer + sizeof (key->type), length
1007 - sizeof (key->type));
1008 return length;
1009}
1010
1011
1012ssize_t
1013GNUNET_IDENTITY_write_key_to_buffer (const struct
1014 GNUNET_IDENTITY_PublicKey *key,
1015 void*buffer,
1016 size_t len)
1017{
1018 const ssize_t length = GNUNET_IDENTITY_key_get_length (key);
1019 if (len < length)
1020 return -1;
1021 if (length < 0)
1022 return -2;
1023 GNUNET_memcpy (buffer, key, length);
1024 return length;
1025}
1026
1027
1028ssize_t
1029GNUNET_IDENTITY_signature_get_length (const struct
1030 GNUNET_IDENTITY_Signature *sig)
1031{
1032 switch (ntohl (sig->type))
1033 {
1034 case GNUNET_IDENTITY_TYPE_ECDSA:
1035 return sizeof (sig->type) + sizeof (sig->ecdsa_signature);
1036 break;
1037 case GNUNET_IDENTITY_TYPE_EDDSA:
1038 return sizeof (sig->type) + sizeof (sig->eddsa_signature);
1039 break;
1040 default:
1041 GNUNET_break (0);
1042 }
1043 return -1;
1044}
1045
1046
1047ssize_t
1048GNUNET_IDENTITY_read_signature_from_buffer (struct
1049 GNUNET_IDENTITY_Signature *sig,
1050 const void*buffer,
1051 size_t len)
1052{
1053 if (len < sizeof (sig->type))
1054 return -1;
1055 GNUNET_memcpy (&(sig->type), buffer, sizeof (sig->type));
1056 const ssize_t length = GNUNET_IDENTITY_signature_get_length (sig);
1057 if (len < length)
1058 return -1;
1059 if (length < 0)
1060 return -2;
1061 GNUNET_memcpy (&(sig->ecdsa_signature), buffer + sizeof (sig->type), length
1062 - sizeof (sig->type));
1063 return length;
1064}
1065
1066
1067ssize_t
1068GNUNET_IDENTITY_write_signature_to_buffer (const struct
1069 GNUNET_IDENTITY_Signature *sig,
1070 void*buffer,
1071 size_t len)
1072{
1073 const ssize_t length = GNUNET_IDENTITY_signature_get_length (sig);
1074 if (len < length)
1075 return -1;
1076 if (length < 0)
1077 return -2;
1078 GNUNET_memcpy (buffer, &(sig->type), sizeof (sig->type));
1079 GNUNET_memcpy (buffer + sizeof (sig->type), &(sig->ecdsa_signature), length
1080 - sizeof (sig->type));
1081 return length;
1082}
1083
1084
1085int
1086GNUNET_IDENTITY_sign_ (const struct
1087 GNUNET_IDENTITY_PrivateKey *priv,
1088 const struct
1089 GNUNET_CRYPTO_EccSignaturePurpose *purpose,
1090 struct GNUNET_IDENTITY_Signature *sig)
1091{
1092 sig->type = priv->type;
1093 switch (ntohl (priv->type))
1094 {
1095 case GNUNET_IDENTITY_TYPE_ECDSA:
1096 return GNUNET_CRYPTO_ecdsa_sign_ (&(priv->ecdsa_key), purpose,
1097 &(sig->ecdsa_signature));
1098 break;
1099 case GNUNET_IDENTITY_TYPE_EDDSA:
1100 return GNUNET_CRYPTO_eddsa_sign_ (&(priv->eddsa_key), purpose,
1101 &(sig->eddsa_signature));
1102 break;
1103 default:
1104 GNUNET_break (0);
1105 }
1106
1107 return GNUNET_SYSERR;
1108}
1109
1110
1111int
1112GNUNET_IDENTITY_signature_verify_ (uint32_t purpose,
1113 const struct
1114 GNUNET_CRYPTO_EccSignaturePurpose *validate,
1115 const struct GNUNET_IDENTITY_Signature *sig,
1116 const struct GNUNET_IDENTITY_PublicKey *pub)
1117{
1118 /* check type matching of 'sig' and 'pub' */
1119 GNUNET_assert (ntohl (pub->type) == ntohl (sig->type));
1120 switch (ntohl (pub->type))
1121 {
1122 case GNUNET_IDENTITY_TYPE_ECDSA:
1123 return GNUNET_CRYPTO_ecdsa_verify_ (purpose, validate,
1124 &(sig->ecdsa_signature),
1125 &(pub->ecdsa_key));
1126 break;
1127 case GNUNET_IDENTITY_TYPE_EDDSA:
1128 return GNUNET_CRYPTO_eddsa_verify_ (purpose, validate,
1129 &(sig->eddsa_signature),
1130 &(pub->eddsa_key));
1131 break;
1132 default:
1133 GNUNET_break (0);
1134 }
1135
1136 return GNUNET_SYSERR;
1137}
1138
1139
1140ssize_t
1141GNUNET_IDENTITY_encrypt (const void *block,
1142 size_t size,
1143 const struct GNUNET_IDENTITY_PublicKey *pub,
1144 struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
1145 void *result)
1146{
1147 struct GNUNET_CRYPTO_EcdhePrivateKey pk;
1148 GNUNET_CRYPTO_ecdhe_key_create (&pk);
1149 struct GNUNET_HashCode hash;
1150 switch (ntohl (pub->type))
1151 {
1152 case GNUNET_IDENTITY_TYPE_ECDSA:
1153 if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdh_ecdsa (&pk, &(pub->ecdsa_key),
1154 &hash))
1155 return -1;
1156 break;
1157 case GNUNET_IDENTITY_TYPE_EDDSA:
1158 if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdh_eddsa (&pk, &(pub->eddsa_key),
1159 &hash))
1160 return -1;
1161 break;
1162 default:
1163 return -1;
1164 }
1165 GNUNET_CRYPTO_ecdhe_key_get_public (&pk, ecc);
1166 GNUNET_CRYPTO_ecdhe_key_clear (&pk);
1167 struct GNUNET_CRYPTO_SymmetricSessionKey key;
1168 struct GNUNET_CRYPTO_SymmetricInitializationVector iv;
1169 GNUNET_CRYPTO_hash_to_aes_key (&hash, &key, &iv);
1170 GNUNET_CRYPTO_zero_keys (&hash, sizeof(hash));
1171 const ssize_t encrypted = GNUNET_CRYPTO_symmetric_encrypt (block, size, &key,
1172 &iv, result);
1173 GNUNET_CRYPTO_zero_keys (&key, sizeof(key));
1174 GNUNET_CRYPTO_zero_keys (&iv, sizeof(iv));
1175 return encrypted;
1176}
1177
1178
1179ssize_t
1180GNUNET_IDENTITY_decrypt (const void *block,
1181 size_t size,
1182 const struct GNUNET_IDENTITY_PrivateKey *priv,
1183 const struct GNUNET_CRYPTO_EcdhePublicKey *ecc,
1184 void *result)
1185{
1186 struct GNUNET_HashCode hash;
1187 switch (ntohl (priv->type))
1188 {
1189 case GNUNET_IDENTITY_TYPE_ECDSA:
1190 if (GNUNET_SYSERR == GNUNET_CRYPTO_ecdsa_ecdh (&(priv->ecdsa_key), ecc,
1191 &hash))
1192 return -1;
1193 break;
1194 case GNUNET_IDENTITY_TYPE_EDDSA:
1195 if (GNUNET_SYSERR == GNUNET_CRYPTO_eddsa_ecdh (&(priv->eddsa_key), ecc,
1196 &hash))
1197 return -1;
1198 break;
1199 default:
1200 return -1;
1201 }
1202 struct GNUNET_CRYPTO_SymmetricSessionKey key;
1203 struct GNUNET_CRYPTO_SymmetricInitializationVector iv;
1204 GNUNET_CRYPTO_hash_to_aes_key (&hash, &key, &iv);
1205 GNUNET_CRYPTO_zero_keys (&hash, sizeof(hash));
1206 const ssize_t decrypted = GNUNET_CRYPTO_symmetric_decrypt (block, size, &key,
1207 &iv, result);
1208 GNUNET_CRYPTO_zero_keys (&key, sizeof(key));
1209 GNUNET_CRYPTO_zero_keys (&iv, sizeof(iv));
1210 return decrypted;
1211}
1212
1213
1214char *
1215GNUNET_IDENTITY_public_key_to_string (const struct
1216 GNUNET_IDENTITY_PublicKey *key)
1217{
1218 size_t size = GNUNET_IDENTITY_key_get_length (key);
1219 return GNUNET_STRINGS_data_to_string_alloc (key,
1220 size);
1221}
1222
1223
1224char *
1225GNUNET_IDENTITY_private_key_to_string (const struct
1226 GNUNET_IDENTITY_PrivateKey *key)
1227{
1228 size_t size = private_key_get_length (key);
1229 return GNUNET_STRINGS_data_to_string_alloc (key,
1230 size);
1231}
1232
1233
1234enum GNUNET_GenericReturnValue
1235GNUNET_IDENTITY_public_key_from_string (const char *str,
1236 struct GNUNET_IDENTITY_PublicKey *key)
1237{
1238 enum GNUNET_GenericReturnValue ret;
1239 enum GNUNET_IDENTITY_KeyType ktype;
1240 ret = GNUNET_STRINGS_string_to_data (str,
1241 strlen (str),
1242 key,
1243 sizeof (*key));
1244 if (GNUNET_OK != ret)
1245 return GNUNET_SYSERR;
1246 ktype = ntohl (key->type);
1247 return (GNUNET_IDENTITY_TYPE_ECDSA == ktype) ? GNUNET_OK : GNUNET_SYSERR; // FIXME other keys, cleaner way?
1248
1249}
1250
1251
1252enum GNUNET_GenericReturnValue
1253GNUNET_IDENTITY_private_key_from_string (const char *str,
1254 struct GNUNET_IDENTITY_PrivateKey *key)
1255{
1256 enum GNUNET_GenericReturnValue ret;
1257 enum GNUNET_IDENTITY_KeyType ktype;
1258 ret = GNUNET_STRINGS_string_to_data (str,
1259 strlen (str),
1260 key,
1261 sizeof (*key));
1262 if (GNUNET_OK != ret)
1263 return GNUNET_SYSERR;
1264 ktype = ntohl (key->type);
1265 return (GNUNET_IDENTITY_TYPE_ECDSA == ktype) ? GNUNET_OK : GNUNET_SYSERR; // FIXME other keys, cleaner way?
1266}
1267
1268
920/* end of identity_api.c */ 1269/* end of identity_api.c */
diff --git a/src/identity/identity_api_lookup.c b/src/identity/identity_api_lookup.c
index 26b1eacd7..51afb2515 100644
--- a/src/identity/identity_api_lookup.c
+++ b/src/identity/identity_api_lookup.c
@@ -127,14 +127,12 @@ handle_identity_update (void *cls, const struct UpdateMessage *um)
127 struct GNUNET_IDENTITY_EgoLookup *el = cls; 127 struct GNUNET_IDENTITY_EgoLookup *el = cls;
128 uint16_t name_len = ntohs (um->name_len); 128 uint16_t name_len = ntohs (um->name_len);
129 const char *str = (0 == name_len) ? NULL : (const char *) &um[1]; 129 const char *str = (0 == name_len) ? NULL : (const char *) &um[1];
130 struct GNUNET_CRYPTO_EcdsaPublicKey pub;
131 struct GNUNET_HashCode id; 130 struct GNUNET_HashCode id;
132 struct GNUNET_IDENTITY_Ego ego; 131 struct GNUNET_IDENTITY_Ego ego;
133 memset (&ego, 0, sizeof (ego)); 132 memset (&ego, 0, sizeof (ego));
134 133
135 GNUNET_break (GNUNET_YES != ntohs (um->end_of_list)); 134 GNUNET_break (GNUNET_YES != ntohs (um->end_of_list));
136 GNUNET_CRYPTO_ecdsa_key_get_public (&um->private_key, &pub); 135 GNUNET_CRYPTO_hash (&um->private_key, sizeof(um->private_key), &id);
137 GNUNET_CRYPTO_hash (&pub, sizeof(pub), &id);
138 ego.pk = um->private_key; 136 ego.pk = um->private_key;
139 ego.name = (char *) str; 137 ego.name = (char *) str;
140 ego.id = id; 138 ego.id = id;
diff --git a/src/identity/plugin_rest_identity.c b/src/identity/plugin_rest_identity.c
index d86d29e36..dba1d478d 100644
--- a/src/identity/plugin_rest_identity.c
+++ b/src/identity/plugin_rest_identity.c
@@ -384,7 +384,7 @@ ego_get_for_subsystem (void *cls,
384{ 384{
385 struct RequestHandle *handle = cls; 385 struct RequestHandle *handle = cls;
386 struct MHD_Response *resp; 386 struct MHD_Response *resp;
387 struct GNUNET_CRYPTO_EcdsaPublicKey public_key; 387 struct GNUNET_IDENTITY_PublicKey public_key;
388 json_t *json_root; 388 json_t *json_root;
389 char *result_str; 389 char *result_str;
390 char *public_key_string; 390 char *public_key_string;
@@ -398,7 +398,7 @@ ego_get_for_subsystem (void *cls,
398 } 398 }
399 399
400 GNUNET_IDENTITY_ego_get_public_key (ego, &public_key); 400 GNUNET_IDENTITY_ego_get_public_key (ego, &public_key);
401 public_key_string = GNUNET_CRYPTO_ecdsa_public_key_to_string (&public_key); 401 public_key_string = GNUNET_IDENTITY_public_key_to_string (&public_key);
402 402
403 // create json with subsystem identity 403 // create json with subsystem identity
404 json_root = json_object (); 404 json_root = json_object ();
@@ -496,7 +496,7 @@ ego_get_all (struct GNUNET_REST_RequestHandle *con_handle,
496 GNUNET_CONTAINER_multihashmap_contains ( 496 GNUNET_CONTAINER_multihashmap_contains (
497 handle->rest_handle->url_param_map, &key)) 497 handle->rest_handle->url_param_map, &key))
498 { 498 {
499 privkey_str = GNUNET_CRYPTO_ecdsa_private_key_to_string ( 499 privkey_str = GNUNET_IDENTITY_private_key_to_string (
500 GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego)); 500 GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego));
501 json_object_set_new (json_ego, 501 json_object_set_new (json_ego,
502 GNUNET_REST_IDENTITY_PARAM_PRIVKEY, 502 GNUNET_REST_IDENTITY_PARAM_PRIVKEY,
@@ -549,7 +549,7 @@ ego_get_response (struct RequestHandle *handle, struct EgoEntry *ego_entry)
549 GNUNET_CONTAINER_multihashmap_contains ( 549 GNUNET_CONTAINER_multihashmap_contains (
550 handle->rest_handle->url_param_map, &key)) 550 handle->rest_handle->url_param_map, &key))
551 { 551 {
552 privkey_str = GNUNET_CRYPTO_ecdsa_private_key_to_string ( 552 privkey_str = GNUNET_IDENTITY_private_key_to_string (
553 GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego)); 553 GNUNET_IDENTITY_ego_get_private_key (ego_entry->ego));
554 json_object_set_new (json_ego, 554 json_object_set_new (json_ego,
555 GNUNET_REST_IDENTITY_PARAM_PRIVKEY, 555 GNUNET_REST_IDENTITY_PARAM_PRIVKEY,
@@ -686,7 +686,7 @@ do_finished (void *cls, const char *emsg)
686 */ 686 */
687static void 687static void
688do_finished_create (void *cls, 688do_finished_create (void *cls,
689 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, 689 const struct GNUNET_IDENTITY_PrivateKey *pk,
690 const char *emsg) 690 const char *emsg)
691{ 691{
692 struct RequestHandle *handle = cls; 692 struct RequestHandle *handle = cls;
@@ -999,8 +999,8 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle,
999 json_error_t err; 999 json_error_t err;
1000 char *egoname; 1000 char *egoname;
1001 char *privkey; 1001 char *privkey;
1002 struct GNUNET_CRYPTO_EcdsaPrivateKey pk; 1002 struct GNUNET_IDENTITY_PrivateKey pk;
1003 struct GNUNET_CRYPTO_EcdsaPrivateKey *pk_ptr; 1003 struct GNUNET_IDENTITY_PrivateKey *pk_ptr;
1004 int json_unpack_state; 1004 int json_unpack_state;
1005 char term_data[handle->data_size + 1]; 1005 char term_data[handle->data_size + 1];
1006 1006
@@ -1074,7 +1074,7 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle,
1074 strlen (privkey), 1074 strlen (privkey),
1075 &pk, 1075 &pk,
1076 sizeof(struct 1076 sizeof(struct
1077 GNUNET_CRYPTO_EcdsaPrivateKey)); 1077 GNUNET_IDENTITY_PrivateKey));
1078 pk_ptr = &pk; 1078 pk_ptr = &pk;
1079 } 1079 }
1080 else 1080 else
@@ -1084,6 +1084,7 @@ ego_create (struct GNUNET_REST_RequestHandle *con_handle,
1084 handle->op = GNUNET_IDENTITY_create (identity_handle, 1084 handle->op = GNUNET_IDENTITY_create (identity_handle,
1085 handle->name, 1085 handle->name,
1086 pk_ptr, 1086 pk_ptr,
1087 GNUNET_IDENTITY_TYPE_ECDSA,
1087 &do_finished_create, 1088 &do_finished_create,
1088 handle); 1089 handle);
1089} 1090}
@@ -1208,7 +1209,7 @@ list_ego (void *cls,
1208 const char *identifier) 1209 const char *identifier)
1209{ 1210{
1210 struct EgoEntry *ego_entry; 1211 struct EgoEntry *ego_entry;
1211 struct GNUNET_CRYPTO_EcdsaPublicKey pk; 1212 struct GNUNET_IDENTITY_PublicKey pk;
1212 1213
1213 if ((NULL == ego) && (ID_REST_STATE_INIT == state)) 1214 if ((NULL == ego) && (ID_REST_STATE_INIT == state))
1214 { 1215 {
@@ -1219,7 +1220,7 @@ list_ego (void *cls,
1219 { 1220 {
1220 ego_entry = GNUNET_new (struct EgoEntry); 1221 ego_entry = GNUNET_new (struct EgoEntry);
1221 GNUNET_IDENTITY_ego_get_public_key (ego, &pk); 1222 GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
1222 ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); 1223 ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk);
1223 ego_entry->ego = ego; 1224 ego_entry->ego = ego;
1224 ego_entry->identifier = GNUNET_strdup (identifier); 1225 ego_entry->identifier = GNUNET_strdup (identifier);
1225 GNUNET_CONTAINER_DLL_insert_tail (ego_head, 1226 GNUNET_CONTAINER_DLL_insert_tail (ego_head,
@@ -1245,7 +1246,7 @@ list_ego (void *cls,
1245 /* Add */ 1246 /* Add */
1246 ego_entry = GNUNET_new (struct EgoEntry); 1247 ego_entry = GNUNET_new (struct EgoEntry);
1247 GNUNET_IDENTITY_ego_get_public_key (ego, &pk); 1248 GNUNET_IDENTITY_ego_get_public_key (ego, &pk);
1248 ego_entry->keystring = GNUNET_CRYPTO_ecdsa_public_key_to_string (&pk); 1249 ego_entry->keystring = GNUNET_IDENTITY_public_key_to_string (&pk);
1249 ego_entry->ego = ego; 1250 ego_entry->ego = ego;
1250 ego_entry->identifier = GNUNET_strdup (identifier); 1251 ego_entry->identifier = GNUNET_strdup (identifier);
1251 GNUNET_CONTAINER_DLL_insert_tail (ego_head, 1252 GNUNET_CONTAINER_DLL_insert_tail (ego_head,
diff --git a/src/identity/test_identity.c b/src/identity/test_identity.c
index 37eeab238..4954fe7be 100644
--- a/src/identity/test_identity.c
+++ b/src/identity/test_identity.c
@@ -253,7 +253,7 @@ success_rename_cont (void *cls, const char *emsg)
253 */ 253 */
254static void 254static void
255create_cb (void *cls, 255create_cb (void *cls,
256 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, 256 const struct GNUNET_IDENTITY_PrivateKey *pk,
257 const char *emsg) 257 const char *emsg)
258{ 258{
259 CHECK (NULL != pk); 259 CHECK (NULL != pk);
@@ -279,7 +279,11 @@ run (void *cls,
279 GNUNET_SCHEDULER_add_shutdown (&cleanup, NULL); 279 GNUNET_SCHEDULER_add_shutdown (&cleanup, NULL);
280 h = GNUNET_IDENTITY_connect (cfg, &notification_cb, NULL); 280 h = GNUNET_IDENTITY_connect (cfg, &notification_cb, NULL);
281 CHECK (NULL != h); 281 CHECK (NULL != h);
282 op = GNUNET_IDENTITY_create (h, "test-id", NULL, &create_cb, NULL); 282 op = GNUNET_IDENTITY_create (h,
283 "test-id",
284 NULL,
285 GNUNET_IDENTITY_TYPE_ECDSA,
286 &create_cb, NULL);
283} 287}
284 288
285 289
diff --git a/src/identity/test_identity_defaults.c b/src/identity/test_identity_defaults.c
index 53eec1252..2d5244d1b 100644
--- a/src/identity/test_identity_defaults.c
+++ b/src/identity/test_identity_defaults.c
@@ -241,7 +241,7 @@ notification_cb (void *cls,
241 */ 241 */
242static void 242static void
243create_cb (void *cls, 243create_cb (void *cls,
244 const struct GNUNET_CRYPTO_EcdsaPrivateKey *pk, 244 const struct GNUNET_IDENTITY_PrivateKey *pk,
245 const char *emsg) 245 const char *emsg)
246{ 246{
247 CHECK (NULL == emsg); 247 CHECK (NULL == emsg);
@@ -266,7 +266,11 @@ run_set (void *cls,
266 GNUNET_SCHEDULER_add_shutdown (&cleanup, NULL); 266 GNUNET_SCHEDULER_add_shutdown (&cleanup, NULL);
267 h = GNUNET_IDENTITY_connect (cfg, &notification_cb, NULL); 267 h = GNUNET_IDENTITY_connect (cfg, &notification_cb, NULL);
268 CHECK (NULL != h); 268 CHECK (NULL != h);
269 op = GNUNET_IDENTITY_create (h, "test-id", NULL, &create_cb, NULL); 269 op = GNUNET_IDENTITY_create (h,
270 "test-id",
271 NULL,
272 GNUNET_IDENTITY_TYPE_ECDSA,
273 &create_cb, NULL);
270} 274}
271 275
272 276