diff options
-rw-r--r-- | src/credential/credential.h | 18 | ||||
-rw-r--r-- | src/credential/credential_api.c | 68 | ||||
-rw-r--r-- | src/credential/credential_serialization.c | 2 | ||||
-rw-r--r-- | src/credential/delegate_misc.c | 4 | ||||
-rw-r--r-- | src/credential/gnunet-credential.c | 19 | ||||
-rw-r--r-- | src/credential/gnunet-service-credential.c | 49 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_and3.sh | 97 | ||||
-rw-r--r-- | src/include/gnunet_credential_service.h | 13 | ||||
-rw-r--r-- | src/include/gnunet_protocols.h | 2 | ||||
-rw-r--r-- | src/include/gnunet_signatures.h | 6 |
10 files changed, 260 insertions, 18 deletions
diff --git a/src/credential/credential.h b/src/credential/credential.h index 43ecec73f..504c7b464 100644 --- a/src/credential/credential.h +++ b/src/credential/credential.h | |||
@@ -145,6 +145,24 @@ struct DelegationChainResultMessage | |||
145 | /* followed by ad_count GNUNET_CREDENTIAL_RecordData structs*/ | 145 | /* followed by ad_count GNUNET_CREDENTIAL_RecordData structs*/ |
146 | }; | 146 | }; |
147 | 147 | ||
148 | /** | ||
149 | * Message from CREDENTIAL service to client: new results. | ||
150 | */ | ||
151 | struct DelegationChainIntermediateMessage | ||
152 | { | ||
153 | /** | ||
154 | * Header of type #GNUNET_MESSAGE_TYPE_CREDENTIAL_INTERMEDIATE_RESULT | ||
155 | */ | ||
156 | struct GNUNET_MessageHeader header; | ||
157 | |||
158 | /** | ||
159 | * Unique identifier for this request (for key collisions). | ||
160 | */ | ||
161 | uint32_t id GNUNET_PACKED; | ||
162 | |||
163 | uint32_t size GNUNET_PACKED; | ||
164 | }; | ||
165 | |||
148 | struct DelegationRecordData | 166 | struct DelegationRecordData |
149 | { | 167 | { |
150 | /** | 168 | /** |
diff --git a/src/credential/credential_api.c b/src/credential/credential_api.c index 7c3b35464..dd66c8c72 100644 --- a/src/credential/credential_api.c +++ b/src/credential/credential_api.c | |||
@@ -69,6 +69,16 @@ struct GNUNET_CREDENTIAL_Request | |||
69 | void *proc_cls; | 69 | void *proc_cls; |
70 | 70 | ||
71 | /** | 71 | /** |
72 | * processor to call on intermediate result | ||
73 | */ | ||
74 | GNUNET_CREDENTIAL_IntermediateResultProcessor int_proc; | ||
75 | |||
76 | /** | ||
77 | * @e verify_proc2 closure | ||
78 | */ | ||
79 | void *proc2_cls; | ||
80 | |||
81 | /** | ||
72 | * Envelope with the message for this queue entry. | 82 | * Envelope with the message for this queue entry. |
73 | */ | 83 | */ |
74 | struct GNUNET_MQ_Envelope *env; | 84 | struct GNUNET_MQ_Envelope *env; |
@@ -247,6 +257,48 @@ handle_result (void *cls, const struct DelegationChainResultMessage *vr_msg) | |||
247 | } | 257 | } |
248 | } | 258 | } |
249 | 259 | ||
260 | static int | ||
261 | check_intermediate (void *cls, const struct DelegationChainIntermediateMessage *vr_msg) | ||
262 | { | ||
263 | //TODO | ||
264 | return GNUNET_OK; | ||
265 | } | ||
266 | |||
267 | static void | ||
268 | handle_intermediate (void *cls, const struct DelegationChainIntermediateMessage *vr_msg) | ||
269 | { | ||
270 | struct GNUNET_CREDENTIAL_Handle *handle = cls; | ||
271 | uint32_t r_id = ntohl (vr_msg->id); | ||
272 | uint32_t size = ntohl (vr_msg->size); | ||
273 | struct GNUNET_CREDENTIAL_Request *vr; | ||
274 | GNUNET_CREDENTIAL_IntermediateResultProcessor proc; | ||
275 | void *proc_cls; | ||
276 | struct GNUNET_CREDENTIAL_Delegation *dd; | ||
277 | |||
278 | LOG (GNUNET_ERROR_TYPE_DEBUG, "Received intermediate reply from CREDENTIAL service\n"); | ||
279 | for (vr = handle->request_head; NULL != vr; vr = vr->next) | ||
280 | if (vr->r_id == r_id) | ||
281 | break; | ||
282 | if (NULL == vr) | ||
283 | return; | ||
284 | |||
285 | proc = vr->int_proc; | ||
286 | proc_cls = vr->proc2_cls; | ||
287 | |||
288 | dd = GNUNET_new (struct GNUNET_CREDENTIAL_Delegation); | ||
289 | GNUNET_assert ( | ||
290 | GNUNET_OK == | ||
291 | GNUNET_CREDENTIAL_delegation_chain_deserialize (size, | ||
292 | (const char *) &vr_msg[1], | ||
293 | 1, | ||
294 | dd, | ||
295 | 0, | ||
296 | NULL)); | ||
297 | |||
298 | proc (proc_cls, dd); | ||
299 | } | ||
300 | |||
301 | |||
250 | 302 | ||
251 | /** | 303 | /** |
252 | * Reconnect to CREDENTIAL service. | 304 | * Reconnect to CREDENTIAL service. |
@@ -265,6 +317,10 @@ reconnect (struct GNUNET_CREDENTIAL_Handle *handle) | |||
265 | GNUNET_MESSAGE_TYPE_CREDENTIAL_COLLECT_RESULT, | 317 | GNUNET_MESSAGE_TYPE_CREDENTIAL_COLLECT_RESULT, |
266 | struct DelegationChainResultMessage, | 318 | struct DelegationChainResultMessage, |
267 | handle), | 319 | handle), |
320 | GNUNET_MQ_hd_var_size (intermediate, | ||
321 | GNUNET_MESSAGE_TYPE_CREDENTIAL_INTERMEDIATE_RESULT, | ||
322 | struct DelegationChainIntermediateMessage, | ||
323 | handle), | ||
268 | GNUNET_MQ_handler_end ()}; | 324 | GNUNET_MQ_handler_end ()}; |
269 | struct GNUNET_CREDENTIAL_Request *vr; | 325 | struct GNUNET_CREDENTIAL_Request *vr; |
270 | 326 | ||
@@ -365,7 +421,9 @@ GNUNET_CREDENTIAL_collect ( | |||
365 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *subject_key, | 421 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *subject_key, |
366 | enum GNUNET_CREDENTIAL_AlgoDirectionFlags direction, | 422 | enum GNUNET_CREDENTIAL_AlgoDirectionFlags direction, |
367 | GNUNET_CREDENTIAL_CredentialResultProcessor proc, | 423 | GNUNET_CREDENTIAL_CredentialResultProcessor proc, |
368 | void *proc_cls) | 424 | void *proc_cls, |
425 | GNUNET_CREDENTIAL_IntermediateResultProcessor proc2, | ||
426 | void *proc2_cls) | ||
369 | { | 427 | { |
370 | /* IPC to shorten credential names, return shorten_handle */ | 428 | /* IPC to shorten credential names, return shorten_handle */ |
371 | struct CollectMessage *c_msg; | 429 | struct CollectMessage *c_msg; |
@@ -392,6 +450,8 @@ GNUNET_CREDENTIAL_collect ( | |||
392 | vr->credential_handle = handle; | 450 | vr->credential_handle = handle; |
393 | vr->verify_proc = proc; | 451 | vr->verify_proc = proc; |
394 | vr->proc_cls = proc_cls; | 452 | vr->proc_cls = proc_cls; |
453 | vr->int_proc = proc2; | ||
454 | vr->proc2_cls = proc2_cls; | ||
395 | vr->r_id = handle->r_id_gen++; | 455 | vr->r_id = handle->r_id_gen++; |
396 | vr->env = | 456 | vr->env = |
397 | GNUNET_MQ_msg_extra (c_msg, nlen, GNUNET_MESSAGE_TYPE_CREDENTIAL_COLLECT); | 457 | GNUNET_MQ_msg_extra (c_msg, nlen, GNUNET_MESSAGE_TYPE_CREDENTIAL_COLLECT); |
@@ -435,7 +495,9 @@ GNUNET_CREDENTIAL_verify ( | |||
435 | const struct GNUNET_CREDENTIAL_Delegate *delegates, | 495 | const struct GNUNET_CREDENTIAL_Delegate *delegates, |
436 | enum GNUNET_CREDENTIAL_AlgoDirectionFlags direction, | 496 | enum GNUNET_CREDENTIAL_AlgoDirectionFlags direction, |
437 | GNUNET_CREDENTIAL_CredentialResultProcessor proc, | 497 | GNUNET_CREDENTIAL_CredentialResultProcessor proc, |
438 | void *proc_cls) | 498 | void *proc_cls, |
499 | GNUNET_CREDENTIAL_IntermediateResultProcessor proc2, | ||
500 | void *proc2_cls) | ||
439 | { | 501 | { |
440 | /* IPC to shorten credential names, return shorten_handle */ | 502 | /* IPC to shorten credential names, return shorten_handle */ |
441 | struct VerifyMessage *v_msg; | 503 | struct VerifyMessage *v_msg; |
@@ -465,6 +527,8 @@ GNUNET_CREDENTIAL_verify ( | |||
465 | vr->credential_handle = handle; | 527 | vr->credential_handle = handle; |
466 | vr->verify_proc = proc; | 528 | vr->verify_proc = proc; |
467 | vr->proc_cls = proc_cls; | 529 | vr->proc_cls = proc_cls; |
530 | vr->int_proc = proc2; | ||
531 | vr->proc2_cls = proc2_cls; | ||
468 | vr->r_id = handle->r_id_gen++; | 532 | vr->r_id = handle->r_id_gen++; |
469 | vr->env = | 533 | vr->env = |
470 | GNUNET_MQ_msg_extra (v_msg, nlen, GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY); | 534 | GNUNET_MQ_msg_extra (v_msg, nlen, GNUNET_MESSAGE_TYPE_CREDENTIAL_VERIFY); |
diff --git a/src/credential/credential_serialization.c b/src/credential/credential_serialization.c index 240ab4dca..28773de8e 100644 --- a/src/credential/credential_serialization.c +++ b/src/credential/credential_serialization.c | |||
@@ -191,7 +191,7 @@ GNUNET_CREDENTIAL_delegates_serialize ( | |||
191 | c_rec.issuer_key = cd[i].issuer_key; | 191 | c_rec.issuer_key = cd[i].issuer_key; |
192 | c_rec.subject_key = cd[i].subject_key; | 192 | c_rec.subject_key = cd[i].subject_key; |
193 | c_rec.signature = cd[i].signature; | 193 | c_rec.signature = cd[i].signature; |
194 | c_rec.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_CREDENTIAL); | 194 | c_rec.purpose.purpose = htonl (GNUNET_SIGNATURE_PURPOSE_DELEGATE); |
195 | c_rec.purpose.size = | 195 | c_rec.purpose.size = |
196 | htonl ((sizeof (struct DelegateEntry) + cd[i].issuer_attribute_len) - | 196 | htonl ((sizeof (struct DelegateEntry) + cd[i].issuer_attribute_len) - |
197 | sizeof (struct GNUNET_CRYPTO_EcdsaSignature)); | 197 | sizeof (struct GNUNET_CRYPTO_EcdsaSignature)); |
diff --git a/src/credential/delegate_misc.c b/src/credential/delegate_misc.c index e29859e8c..25356ef7f 100644 --- a/src/credential/delegate_misc.c +++ b/src/credential/delegate_misc.c | |||
@@ -271,8 +271,4 @@ GNUNET_CREDENTIAL_delegate_issue ( | |||
271 | 271 | ||
272 | GNUNET_free (del); | 272 | GNUNET_free (del); |
273 | return dele; | 273 | return dele; |
274 | |||
275 | // Entweder: strdup und destroy (free auf die subjct_attribute/issuer_attribute) | ||
276 | // oder: pointer auf cred[1], aber nach jedem string im combined string ein EOS <- besser | ||
277 | // function comment: cred must be freed by caller, (add missing sub_iss) | ||
278 | } | 274 | } |
diff --git a/src/credential/gnunet-credential.c b/src/credential/gnunet-credential.c index f2d967eea..aa9828d4b 100644 --- a/src/credential/gnunet-credential.c +++ b/src/credential/gnunet-credential.c | |||
@@ -264,6 +264,17 @@ do_timeout (void *cls) | |||
264 | } | 264 | } |
265 | 265 | ||
266 | static void | 266 | static void |
267 | handle_intermediate_result(void *cls, | ||
268 | struct GNUNET_CREDENTIAL_Delegation *dd) | ||
269 | { | ||
270 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Intermediate result: %s.%s <- %s.%s\n", | ||
271 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&dd->issuer_key), | ||
272 | dd->issuer_attribute, | ||
273 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&dd->subject_key), | ||
274 | dd->subject_attribute); | ||
275 | } | ||
276 | |||
277 | static void | ||
267 | handle_collect_result (void *cls, | 278 | handle_collect_result (void *cls, |
268 | unsigned int d_count, | 279 | unsigned int d_count, |
269 | struct GNUNET_CREDENTIAL_Delegation *dc, | 280 | struct GNUNET_CREDENTIAL_Delegation *dc, |
@@ -395,7 +406,9 @@ identity_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) | |||
395 | privkey, | 406 | privkey, |
396 | direction, | 407 | direction, |
397 | &handle_collect_result, | 408 | &handle_collect_result, |
398 | NULL); | 409 | NULL, |
410 | &handle_intermediate_result, | ||
411 | NULL); | ||
399 | return; | 412 | return; |
400 | } | 413 | } |
401 | GNUNET_SCHEDULER_shutdown (); | 414 | GNUNET_SCHEDULER_shutdown (); |
@@ -901,7 +914,9 @@ run (void *cls, | |||
901 | delegates, | 914 | delegates, |
902 | direction, | 915 | direction, |
903 | &handle_verify_result, | 916 | &handle_verify_result, |
904 | NULL); | 917 | NULL, |
918 | &handle_intermediate_result, | ||
919 | NULL); | ||
905 | for (i = 0; i < count; i++) | 920 | for (i = 0; i < count; i++) |
906 | { | 921 | { |
907 | GNUNET_free ((char *) delegates[i].issuer_attribute); | 922 | GNUNET_free ((char *) delegates[i].issuer_attribute); |
diff --git a/src/credential/gnunet-service-credential.c b/src/credential/gnunet-service-credential.c index 90316f203..cb0dca6b8 100644 --- a/src/credential/gnunet-service-credential.c +++ b/src/credential/gnunet-service-credential.c | |||
@@ -246,7 +246,6 @@ struct DelegationSetQueueEntry | |||
246 | */ | 246 | */ |
247 | struct VerifyRequestHandle | 247 | struct VerifyRequestHandle |
248 | { | 248 | { |
249 | |||
250 | /** | 249 | /** |
251 | * We keep these in a DLL. | 250 | * We keep these in a DLL. |
252 | */ | 251 | */ |
@@ -480,6 +479,48 @@ shutdown_task (void *cls) | |||
480 | } | 479 | } |
481 | } | 480 | } |
482 | 481 | ||
482 | static void | ||
483 | send_intermediate_response(struct VerifyRequestHandle *vrh, struct DelegationChainEntry *ch_entry){ | ||
484 | struct DelegationChainIntermediateMessage *rmsg; | ||
485 | struct GNUNET_MQ_Envelope *env; | ||
486 | struct GNUNET_CREDENTIAL_Delegation *dd; | ||
487 | size_t size; | ||
488 | |||
489 | dd = GNUNET_new (struct GNUNET_CREDENTIAL_Delegation); | ||
490 | dd->issuer_key = ch_entry->issuer_key; | ||
491 | dd->subject_key = ch_entry->subject_key; | ||
492 | dd->issuer_attribute = ch_entry->issuer_attribute; | ||
493 | dd->issuer_attribute_len = strlen (ch_entry->issuer_attribute) + 1; | ||
494 | dd->subject_attribute_len = 0; | ||
495 | dd->subject_attribute = NULL; | ||
496 | if (NULL != ch_entry->subject_attribute) | ||
497 | { | ||
498 | dd->subject_attribute = ch_entry->subject_attribute; | ||
499 | dd->subject_attribute_len = strlen (ch_entry->subject_attribute) + 1; | ||
500 | } | ||
501 | |||
502 | |||
503 | size = GNUNET_CREDENTIAL_delegation_chain_get_size (1, | ||
504 | dd, | ||
505 | 0, | ||
506 | NULL); | ||
507 | |||
508 | env = GNUNET_MQ_msg_extra (rmsg, | ||
509 | size, | ||
510 | GNUNET_MESSAGE_TYPE_CREDENTIAL_INTERMEDIATE_RESULT); | ||
511 | // Assign id so that client can find associated request | ||
512 | rmsg->id = vrh->request_id; | ||
513 | rmsg->size = htonl(size); | ||
514 | |||
515 | GNUNET_assert ( | ||
516 | -1 != GNUNET_CREDENTIAL_delegation_chain_serialize (1, | ||
517 | dd, | ||
518 | 0, | ||
519 | NULL, | ||
520 | size, | ||
521 | (char *) &rmsg[1])); | ||
522 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (vrh->client), env); | ||
523 | } | ||
483 | 524 | ||
484 | static void | 525 | static void |
485 | send_lookup_response (struct VerifyRequestHandle *vrh) | 526 | send_lookup_response (struct VerifyRequestHandle *vrh) |
@@ -821,6 +862,9 @@ forward_resolution (void *cls, | |||
821 | ds_entry->delegation_chain_entry->issuer_key = del->issuer_key; | 862 | ds_entry->delegation_chain_entry->issuer_key = del->issuer_key; |
822 | ds_entry->delegation_chain_entry->issuer_attribute = | 863 | ds_entry->delegation_chain_entry->issuer_attribute = |
823 | GNUNET_strdup (del->issuer_attribute); | 864 | GNUNET_strdup (del->issuer_attribute); |
865 | |||
866 | // Found new entry, repoting intermediate result | ||
867 | send_intermediate_response(vrh, ds_entry->delegation_chain_entry); | ||
824 | 868 | ||
825 | // current delegation as parent | 869 | // current delegation as parent |
826 | ds_entry->parent_queue_entry = dq_entry; | 870 | ds_entry->parent_queue_entry = dq_entry; |
@@ -1035,6 +1079,9 @@ backward_resolution (void *cls, | |||
1035 | ds_entry->delegation_chain_entry->issuer_attribute = | 1079 | ds_entry->delegation_chain_entry->issuer_attribute = |
1036 | GNUNET_strdup (current_set->lookup_attribute); | 1080 | GNUNET_strdup (current_set->lookup_attribute); |
1037 | 1081 | ||
1082 | // Found new entry, repoting intermediate result | ||
1083 | send_intermediate_response(vrh, ds_entry->delegation_chain_entry); | ||
1084 | |||
1038 | ds_entry->parent_queue_entry = dq_entry; // current_delegation; | 1085 | ds_entry->parent_queue_entry = dq_entry; // current_delegation; |
1039 | 1086 | ||
1040 | /** | 1087 | /** |
diff --git a/src/credential/test_credential_bi_and3.sh b/src/credential/test_credential_bi_and3.sh new file mode 100755 index 000000000..83f2374a5 --- /dev/null +++ b/src/credential/test_credential_bi_and3.sh | |||
@@ -0,0 +1,97 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT | ||
3 | |||
4 | LOCATION=$(which gnunet-config) | ||
5 | if [ -z $LOCATION ] | ||
6 | then | ||
7 | LOCATION="gnunet-config" | ||
8 | fi | ||
9 | $LOCATION --version 1> /dev/null | ||
10 | if test $? != 0 | ||
11 | then | ||
12 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | ||
13 | exit 77 | ||
14 | fi | ||
15 | |||
16 | rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` | ||
17 | |||
18 | |||
19 | |||
20 | |||
21 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" | ||
22 | gnunet-arm -s -c test_credential_lookup.conf | ||
23 | |||
24 | gnunet-identity -C a -c test_credential_lookup.conf | ||
25 | gnunet-identity -C b -c test_credential_lookup.conf | ||
26 | gnunet-identity -C c -c test_credential_lookup.conf | ||
27 | gnunet-identity -C d -c test_credential_lookup.conf | ||
28 | gnunet-identity -C e -c test_credential_lookup.conf | ||
29 | gnunet-identity -C f -c test_credential_lookup.conf | ||
30 | gnunet-identity -C g -c test_credential_lookup.conf | ||
31 | gnunet-identity -C h -c test_credential_lookup.conf | ||
32 | AKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep a | awk '{print $3}') | ||
33 | BKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep b | awk '{print $3}') | ||
34 | CKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep c | awk '{print $3}') | ||
35 | DKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep d | awk '{print $3}') | ||
36 | EKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep e | awk '{print $3}') | ||
37 | FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print $3}') | ||
38 | GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}') | ||
39 | HKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep h | awk '{print $3}') | ||
40 | |||
41 | # (1) (A.a) <- B.b | ||
42 | # (2) (B.b) <- C.c AND G.g | ||
43 | # (3) C.c <- (D.d) | ||
44 | # (4) D.d <- (E.e) | ||
45 | # (5) E.e <- (F) priv | ||
46 | # (6) G.g <- (H.h) | ||
47 | # (7) H.h <- (F) priv | ||
48 | |||
49 | # BIDIRECTIONAL | ||
50 | gnunet-credential --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_credential_lookup.conf | ||
51 | gnunet-namestore -D -z a | ||
52 | gnunet-credential --createIssuerSide --ego=b --attribute="b" --subject="$CKEY c, $GKEY g" --ttl=5m -c test_credential_lookup.conf | ||
53 | gnunet-namestore -D -z b | ||
54 | |||
55 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=c --attribute="c" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` | ||
56 | gnunet-credential --createSubjectSide --ego=d --import "$SIGNED" | ||
57 | gnunet-namestore -D -z d | ||
58 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=d --attribute="d" --subject="$EKEY e" --ttl="2019-12-12 10:00:00"` | ||
59 | gnunet-credential --createSubjectSide --ego=e --import "$SIGNED" | ||
60 | gnunet-namestore -D -z e | ||
61 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=g --attribute="g" --subject="$HKEY h" --ttl="2019-12-12 10:00:00"` | ||
62 | gnunet-credential --createSubjectSide --ego=h --import "$SIGNED" | ||
63 | gnunet-namestore -D -z h | ||
64 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=e --attribute="e" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` | ||
65 | gnunet-credential --createSubjectSide --ego=f --import "$SIGNED" --private | ||
66 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=h --attribute="h" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` | ||
67 | gnunet-credential --createSubjectSide --ego=f --import "$SIGNED" --private | ||
68 | gnunet-namestore -D -z f | ||
69 | |||
70 | # Starting to resolve | ||
71 | echo "+++ Starting to Resolve +++" | ||
72 | |||
73 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f -c test_credential_lookup.conf | paste -d, -s - -` | ||
74 | echo $DELS | ||
75 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf | ||
76 | RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf` | ||
77 | |||
78 | # Cleanup properly | ||
79 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf | ||
80 | gnunet-namestore -z b -d -n "b" -t ATTR -c test_credential_lookup.conf | ||
81 | gnunet-namestore -z d -d -n "@" -t DEL -c test_credential_lookup.conf | ||
82 | gnunet-namestore -z e -d -n "@" -t DEL -c test_credential_lookup.conf | ||
83 | gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf | ||
84 | gnunet-namestore -z h -d -n "@" -t DEL -c test_credential_lookup.conf | ||
85 | |||
86 | gnunet-arm -e -c test_credential_lookup.conf | ||
87 | |||
88 | if [ "$RES_DELS" != "Failed." ] | ||
89 | then | ||
90 | # TODO: replace echo -e bashism | ||
91 | echo -e "${RES_DELS}" | ||
92 | exit 0 | ||
93 | else | ||
94 | echo "FAIL: Failed to verify credential $RES_DELS." | ||
95 | exit 1 | ||
96 | fi | ||
97 | |||
diff --git a/src/include/gnunet_credential_service.h b/src/include/gnunet_credential_service.h index be682c3b5..fdee3b641 100644 --- a/src/include/gnunet_credential_service.h +++ b/src/include/gnunet_credential_service.h | |||
@@ -259,7 +259,10 @@ typedef void (*GNUNET_CREDENTIAL_CredentialResultProcessor) (void *cls, | |||
259 | unsigned int d_count, | 259 | unsigned int d_count, |
260 | struct GNUNET_CREDENTIAL_Delegation *delegation_chain, | 260 | struct GNUNET_CREDENTIAL_Delegation *delegation_chain, |
261 | unsigned int c_count, | 261 | unsigned int c_count, |
262 | struct GNUNET_CREDENTIAL_Delegate *credential); | 262 | struct GNUNET_CREDENTIAL_Delegate *delegte); |
263 | |||
264 | typedef void (*GNUNET_CREDENTIAL_IntermediateResultProcessor) (void *cls, | ||
265 | struct GNUNET_CREDENTIAL_Delegation *delegation); | ||
263 | 266 | ||
264 | /** | 267 | /** |
265 | * Iterator called on obtained result for an attribute delegation. | 268 | * Iterator called on obtained result for an attribute delegation. |
@@ -309,7 +312,9 @@ GNUNET_CREDENTIAL_verify (struct GNUNET_CREDENTIAL_Handle *handle, | |||
309 | const struct GNUNET_CREDENTIAL_Delegate *delegates, | 312 | const struct GNUNET_CREDENTIAL_Delegate *delegates, |
310 | enum GNUNET_CREDENTIAL_AlgoDirectionFlags direction, | 313 | enum GNUNET_CREDENTIAL_AlgoDirectionFlags direction, |
311 | GNUNET_CREDENTIAL_CredentialResultProcessor proc, | 314 | GNUNET_CREDENTIAL_CredentialResultProcessor proc, |
312 | void *proc_cls); | 315 | void *proc_cls, |
316 | GNUNET_CREDENTIAL_IntermediateResultProcessor, | ||
317 | void *proc2_cls); | ||
313 | 318 | ||
314 | struct GNUNET_CREDENTIAL_Request* | 319 | struct GNUNET_CREDENTIAL_Request* |
315 | GNUNET_CREDENTIAL_collect (struct GNUNET_CREDENTIAL_Handle *handle, | 320 | GNUNET_CREDENTIAL_collect (struct GNUNET_CREDENTIAL_Handle *handle, |
@@ -318,7 +323,9 @@ GNUNET_CREDENTIAL_collect (struct GNUNET_CREDENTIAL_Handle *handle, | |||
318 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *subject_key, | 323 | const struct GNUNET_CRYPTO_EcdsaPrivateKey *subject_key, |
319 | enum GNUNET_CREDENTIAL_AlgoDirectionFlags direction, | 324 | enum GNUNET_CREDENTIAL_AlgoDirectionFlags direction, |
320 | GNUNET_CREDENTIAL_CredentialResultProcessor proc, | 325 | GNUNET_CREDENTIAL_CredentialResultProcessor proc, |
321 | void *proc_cls); | 326 | void *proc_cls, |
327 | GNUNET_CREDENTIAL_IntermediateResultProcessor, | ||
328 | void *proc2_cls); | ||
322 | 329 | ||
323 | /** | 330 | /** |
324 | * Delegate an attribute | 331 | * Delegate an attribute |
diff --git a/src/include/gnunet_protocols.h b/src/include/gnunet_protocols.h index c932c44d0..4ca1ad47a 100644 --- a/src/include/gnunet_protocols.h +++ b/src/include/gnunet_protocols.h | |||
@@ -2726,6 +2726,8 @@ extern "C" { | |||
2726 | 2726 | ||
2727 | #define GNUNET_MESSAGE_TYPE_CREDENTIAL_COLLECT_RESULT 984 | 2727 | #define GNUNET_MESSAGE_TYPE_CREDENTIAL_COLLECT_RESULT 984 |
2728 | 2728 | ||
2729 | #define GNUNET_MESSAGE_TYPE_CREDENTIAL_INTERMEDIATE_RESULT 985 | ||
2730 | |||
2729 | /******************************************************************************/ | 2731 | /******************************************************************************/ |
2730 | 2732 | ||
2731 | 2733 | ||
diff --git a/src/include/gnunet_signatures.h b/src/include/gnunet_signatures.h index 1d6d5a229..a00e0372d 100644 --- a/src/include/gnunet_signatures.h +++ b/src/include/gnunet_signatures.h | |||
@@ -188,7 +188,7 @@ extern "C" | |||
188 | /** | 188 | /** |
189 | * Signature for a GNUnet credential | 189 | * Signature for a GNUnet credential |
190 | */ | 190 | */ |
191 | #define GNUNET_SIGNATURE_PURPOSE_CREDENTIAL 28 | 191 | #define GNUNET_SIGNATURE_PURPOSE_DELEGATE 28 |
192 | 192 | ||
193 | /** | 193 | /** |
194 | * Signature by a peer affirming that this is one of its | 194 | * Signature by a peer affirming that this is one of its |
@@ -241,10 +241,6 @@ extern "C" | |||
241 | */ | 241 | */ |
242 | #define GNUNET_SIGNATURE_PURPOSE_TRANSPORT_DV_INITIATOR 37 | 242 | #define GNUNET_SIGNATURE_PURPOSE_TRANSPORT_DV_INITIATOR 37 |
243 | 243 | ||
244 | /** | ||
245 | * Signature for a GNUnet delegate | ||
246 | */ | ||
247 | #define GNUNET_SIGNATURE_PURPOSE_DELEGATE 38 | ||
248 | 244 | ||
249 | #if 0 /* keep Emacsens' auto-indent happy */ | 245 | #if 0 /* keep Emacsens' auto-indent happy */ |
250 | { | 246 | { |