diff options
author | Andreas Ebner <a.e.bner@web.de> | 2019-09-20 10:49:02 +0200 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2019-10-07 12:18:20 +0200 |
commit | 3099a7c25cf6b11b0f1909e5a2651d65c0e921c7 (patch) | |
tree | c8f10fe3551b35e40d6adcb5e1c68771a12a104e /src | |
parent | 5be14856a356b087ad97b479efd9b06172fdfd2f (diff) | |
download | gnunet-3099a7c25cf6b11b0f1909e5a2651d65c0e921c7.tar.gz gnunet-3099a7c25cf6b11b0f1909e5a2651d65c0e921c7.zip |
Cleanup TODOs, bugfix in cleanup and start of bidirectional chain resolution:
- removed and/or implemented all remaining TODOs
- fixed a bug in cleanup_handle() which caused to not cleanup correctly when a solution was prematurely found
- delegation_chain_bw/fw_resolution_start() not has a return value to indicate whether a solution was prematurely found
- cleaned up the test_... files (an additional cleanup commit might follow)
Diffstat (limited to 'src')
-rw-r--r-- | src/credential/credential_api.c | 3 | ||||
-rw-r--r-- | src/credential/gnunet-credential.c | 17 | ||||
-rw-r--r-- | src/credential/gnunet-service-credential.c | 62 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_and.sh | 4 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_and2.sh | 4 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_and3.sh | 6 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_and4.sh (renamed from src/credential/test_credential_own_and2.sh) | 4 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_bw.sh | 4 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_bw_link.sh | 4 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_bw_link2.sh | 4 | ||||
-rwxr-xr-x | src/credential/test_credential_bi_fw.sh | 4 | ||||
-rwxr-xr-x | src/credential/test_credential_issue.sh | 9 | ||||
-rwxr-xr-x | src/credential/test_credential_own.sh | 27 | ||||
-rwxr-xr-x | src/credential/test_credential_verify.sh | 41 | ||||
-rwxr-xr-x | src/credential/test_credential_verify_and.sh | 50 | ||||
-rwxr-xr-x | src/credential/test_credential_verify_simple.sh | 30 |
16 files changed, 148 insertions, 125 deletions
diff --git a/src/credential/credential_api.c b/src/credential/credential_api.c index a3eecd52d..7acce7d9e 100644 --- a/src/credential/credential_api.c +++ b/src/credential/credential_api.c | |||
@@ -249,7 +249,7 @@ handle_result (void *cls, const struct DelegationChainResultMessage *vr_msg) | |||
249 | if (GNUNET_NO == ntohl (vr_msg->del_found)) | 249 | if (GNUNET_NO == ntohl (vr_msg->del_found)) |
250 | { | 250 | { |
251 | proc (proc_cls, 0, NULL, 0, | 251 | proc (proc_cls, 0, NULL, 0, |
252 | NULL); // TODO | 252 | NULL); |
253 | } | 253 | } |
254 | else | 254 | else |
255 | { | 255 | { |
@@ -297,7 +297,6 @@ handle_intermediate (void *cls, const struct DelegationChainIntermediateMessage | |||
297 | dd, | 297 | dd, |
298 | 0, | 298 | 0, |
299 | NULL)); | 299 | NULL)); |
300 | sleep(2); | ||
301 | proc (proc_cls, dd, is_bw); | 300 | proc (proc_cls, dd, is_bw); |
302 | } | 301 | } |
303 | 302 | ||
diff --git a/src/credential/gnunet-credential.c b/src/credential/gnunet-credential.c index 0d742d1ef..58f7cf50d 100644 --- a/src/credential/gnunet-credential.c +++ b/src/credential/gnunet-credential.c | |||
@@ -274,13 +274,12 @@ handle_intermediate_result(void *cls, | |||
274 | bool is_bw) | 274 | bool is_bw) |
275 | { | 275 | { |
276 | char *prefix = ""; | 276 | char *prefix = ""; |
277 | // TODO change to printf | ||
278 | if(is_bw) | 277 | if(is_bw) |
279 | prefix = "Backward -"; | 278 | prefix = "Backward -"; |
280 | else | 279 | else |
281 | prefix = "Forward -"; | 280 | prefix = "Forward -"; |
282 | 281 | ||
283 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "%s Intermediate result: %s.%s <- %s.%s\n", | 282 | printf ("%s Intermediate result: %s.%s <- %s.%s\n", |
284 | prefix, | 283 | prefix, |
285 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&dd->issuer_key), | 284 | GNUNET_CRYPTO_ecdsa_public_key_to_string (&dd->issuer_key), |
286 | dd->issuer_attribute, | 285 | dd->issuer_attribute, |
@@ -416,7 +415,7 @@ identity_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) | |||
416 | 415 | ||
417 | collect_request = GNUNET_CREDENTIAL_collect (credential, | 416 | collect_request = GNUNET_CREDENTIAL_collect (credential, |
418 | &issuer_pkey, | 417 | &issuer_pkey, |
419 | issuer_attr, //TODO argument | 418 | issuer_attr, |
420 | privkey, | 419 | privkey, |
421 | direction, | 420 | direction, |
422 | &handle_collect_result, | 421 | &handle_collect_result, |
@@ -487,7 +486,6 @@ error_cb (void *cls) | |||
487 | static void | 486 | static void |
488 | add_continuation (void *cls, int32_t success, const char *emsg) | 487 | add_continuation (void *cls, int32_t success, const char *emsg) |
489 | { | 488 | { |
490 | // TODO what does that do, can I somehow parse an empty callback on success or do I have to set the qe* to NULL? | ||
491 | struct GNUNET_NAMESTORE_QueueEntry **qe = cls; | 489 | struct GNUNET_NAMESTORE_QueueEntry **qe = cls; |
492 | *qe = NULL; | 490 | *qe = NULL; |
493 | 491 | ||
@@ -510,9 +508,8 @@ get_existing_record (void *cls, | |||
510 | rde->data = data; | 508 | rde->data = data; |
511 | rde->data_size = data_size; | 509 | rde->data_size = data_size; |
512 | rde->record_type = type; | 510 | rde->record_type = type; |
513 | // Flags not required , TODO what have we said we do with that now? Look it up in my writing | 511 | |
514 | /*if (1 == is_shadow) | 512 | // Set flags |
515 | rde->flags |= GNUNET_GNSRECORD_RF_SHADOW_RECORD;*/ | ||
516 | if (GNUNET_YES == is_private) | 513 | if (GNUNET_YES == is_private) |
517 | rde->flags |= GNUNET_GNSRECORD_RF_PRIVATE; | 514 | rde->flags |= GNUNET_GNSRECORD_RF_PRIVATE; |
518 | rde->expiration_time = etime; | 515 | rde->expiration_time = etime; |
@@ -520,6 +517,7 @@ get_existing_record (void *cls, | |||
520 | rde->flags |= GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; | 517 | rde->flags |= GNUNET_GNSRECORD_RF_RELATIVE_EXPIRATION; |
521 | else if (GNUNET_NO != etime_is_rel) | 518 | else if (GNUNET_NO != etime_is_rel) |
522 | rde->expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; | 519 | rde->expiration_time = GNUNET_TIME_UNIT_FOREVER_ABS.abs_value_us; |
520 | |||
523 | GNUNET_assert (NULL != rec_name); | 521 | GNUNET_assert (NULL != rec_name); |
524 | add_qe = GNUNET_NAMESTORE_records_store (ns, | 522 | add_qe = GNUNET_NAMESTORE_records_store (ns, |
525 | &zone_pkey, | 523 | &zone_pkey, |
@@ -551,7 +549,6 @@ store_cb (void *cls, const struct GNUNET_IDENTITY_Ego *ego) | |||
551 | // Key handling | 549 | // Key handling |
552 | zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (ego); | 550 | zone_pkey = *GNUNET_IDENTITY_ego_get_private_key (ego); |
553 | 551 | ||
554 | // TODO maybe dont have to set subject, if only used in if/else can use import here instead!! | ||
555 | if (GNUNET_GNSRECORD_TYPE_DELEGATE == type) | 552 | if (GNUNET_GNSRECORD_TYPE_DELEGATE == type) |
556 | { | 553 | { |
557 | // Parse import | 554 | // Parse import |
@@ -922,7 +919,7 @@ run (void *cls, | |||
922 | 919 | ||
923 | verify_request = GNUNET_CREDENTIAL_verify (credential, | 920 | verify_request = GNUNET_CREDENTIAL_verify (credential, |
924 | &issuer_pkey, | 921 | &issuer_pkey, |
925 | issuer_attr, //TODO argument | 922 | issuer_attr, |
926 | &subject_pkey, | 923 | &subject_pkey, |
927 | count, | 924 | count, |
928 | delegates, | 925 | delegates, |
@@ -1053,7 +1050,7 @@ main (int argc, char *const *argv) | |||
1053 | return 2; | 1050 | return 2; |
1054 | 1051 | ||
1055 | GNUNET_log_setup ("gnunet-credential", "WARNING", NULL); | 1052 | GNUNET_log_setup ("gnunet-credential", "WARNING", NULL); |
1056 | if (GNUNET_OK == GNUNET_PROGRAM_run (argc, | 1053 | if (GNUNET_OK != GNUNET_PROGRAM_run (argc, |
1057 | argv, | 1054 | argv, |
1058 | "gnunet-credential", | 1055 | "gnunet-credential", |
1059 | _ ("GNUnet credential resolver tool"), | 1056 | _ ("GNUnet credential resolver tool"), |
diff --git a/src/credential/gnunet-service-credential.c b/src/credential/gnunet-service-credential.c index 5ce0f70d9..daffc0bb9 100644 --- a/src/credential/gnunet-service-credential.c +++ b/src/credential/gnunet-service-credential.c | |||
@@ -429,26 +429,28 @@ cleanup_handle (struct VerifyRequestHandle *vrh) | |||
429 | struct DelegateRecordEntry *del_entry; | 429 | struct DelegateRecordEntry *del_entry; |
430 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up...\n"); | 430 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Cleaning up...\n"); |
431 | 431 | ||
432 | if (NULL == vrh->dsq_head) | 432 | if (NULL != vrh->dsq_head) |
433 | return; | ||
434 | |||
435 | for (struct DelegationSetQueueEntry *ds_entry = vrh->dsq_head; NULL != vrh->dsq_head; | ||
436 | ds_entry = vrh->dsq_head) | ||
437 | { | 433 | { |
438 | GNUNET_CONTAINER_DLL_remove (vrh->dsq_head, vrh->dsq_tail, ds_entry); | 434 | for (struct DelegationSetQueueEntry *ds_entry = vrh->dsq_head; NULL != vrh->dsq_head; |
439 | cleanup_dsq_entry(ds_entry); | 435 | ds_entry = vrh->dsq_head) |
436 | { | ||
437 | GNUNET_CONTAINER_DLL_remove (vrh->dsq_head, vrh->dsq_tail, ds_entry); | ||
438 | cleanup_dsq_entry(ds_entry); | ||
439 | } | ||
440 | } | 440 | } |
441 | 441 | if (NULL != vrh->del_chain_head) | |
442 | GNUNET_free_non_null (vrh->issuer_attribute); | ||
443 | for (del_entry = vrh->del_chain_head; NULL != vrh->del_chain_head; | ||
444 | del_entry = vrh->del_chain_head) | ||
445 | { | 442 | { |
446 | GNUNET_CONTAINER_DLL_remove (vrh->del_chain_head, | 443 | for (del_entry = vrh->del_chain_head; NULL != vrh->del_chain_head; |
447 | vrh->del_chain_tail, | 444 | del_entry = vrh->del_chain_head) |
448 | del_entry); | 445 | { |
449 | GNUNET_free_non_null (del_entry->delegate); | 446 | GNUNET_CONTAINER_DLL_remove (vrh->del_chain_head, |
450 | GNUNET_free (del_entry); | 447 | vrh->del_chain_tail, |
448 | del_entry); | ||
449 | GNUNET_free_non_null (del_entry->delegate); | ||
450 | GNUNET_free (del_entry); | ||
451 | } | ||
451 | } | 452 | } |
453 | GNUNET_free_non_null (vrh->issuer_attribute); | ||
452 | GNUNET_free (vrh); | 454 | GNUNET_free (vrh); |
453 | } | 455 | } |
454 | 456 | ||
@@ -622,7 +624,6 @@ send_lookup_response (struct VerifyRequestHandle *vrh) | |||
622 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (vrh->client), env); | 624 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (vrh->client), env); |
623 | GNUNET_CONTAINER_DLL_remove (vrh_head, vrh_tail, vrh); | 625 | GNUNET_CONTAINER_DLL_remove (vrh_head, vrh_tail, vrh); |
624 | cleanup_handle (vrh); | 626 | cleanup_handle (vrh); |
625 | |||
626 | GNUNET_STATISTICS_update (statistics, | 627 | GNUNET_STATISTICS_update (statistics, |
627 | "Completed verifications", | 628 | "Completed verifications", |
628 | 1, | 629 | 1, |
@@ -1217,7 +1218,7 @@ backward_resolution (void *cls, | |||
1217 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1218 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1218 | "%s still to go...\n", | 1219 | "%s still to go...\n", |
1219 | ds_entry->attr_trailer); | 1220 | ds_entry->attr_trailer); |
1220 | // TODO remove | 1221 | |
1221 | vrh->pending_lookups++; | 1222 | vrh->pending_lookups++; |
1222 | ds_entry->handle = vrh; | 1223 | ds_entry->handle = vrh; |
1223 | ds_entry->lookup_request = | 1224 | ds_entry->lookup_request = |
@@ -1247,9 +1248,11 @@ backward_resolution (void *cls, | |||
1247 | * | 1248 | * |
1248 | * @param cls the closure (our client lookup handle) | 1249 | * @param cls the closure (our client lookup handle) |
1249 | */ | 1250 | */ |
1250 | static void | 1251 | static int |
1251 | delegation_chain_bw_resolution_start (void *cls) | 1252 | delegation_chain_bw_resolution_start (void *cls) |
1252 | { | 1253 | { |
1254 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Start Backward Resolution...\n"); | ||
1255 | |||
1253 | struct VerifyRequestHandle *vrh = cls; | 1256 | struct VerifyRequestHandle *vrh = cls; |
1254 | struct DelegationSetQueueEntry *ds_entry; | 1257 | struct DelegationSetQueueEntry *ds_entry; |
1255 | struct DelegateRecordEntry *del_entry; | 1258 | struct DelegateRecordEntry *del_entry; |
@@ -1258,7 +1261,7 @@ delegation_chain_bw_resolution_start (void *cls) | |||
1258 | { | 1261 | { |
1259 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No delegates found\n"); | 1262 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No delegates found\n"); |
1260 | send_lookup_response (vrh); | 1263 | send_lookup_response (vrh); |
1261 | return; | 1264 | return 2; |
1262 | } | 1265 | } |
1263 | 1266 | ||
1264 | // Pre-check with vrh->dele_chain_.. if match issuer_key | 1267 | // Pre-check with vrh->dele_chain_.. if match issuer_key |
@@ -1281,7 +1284,7 @@ delegation_chain_bw_resolution_start (void *cls) | |||
1281 | del_entry->refcount++; | 1284 | del_entry->refcount++; |
1282 | // Found match prematurely | 1285 | // Found match prematurely |
1283 | send_lookup_response (vrh); | 1286 | send_lookup_response (vrh); |
1284 | return; | 1287 | return 1; |
1285 | } | 1288 | } |
1286 | 1289 | ||
1287 | 1290 | ||
@@ -1321,11 +1324,14 @@ delegation_chain_bw_resolution_start (void *cls) | |||
1321 | GNUNET_GNS_LO_DEFAULT, | 1324 | GNUNET_GNS_LO_DEFAULT, |
1322 | &backward_resolution, | 1325 | &backward_resolution, |
1323 | ds_entry); | 1326 | ds_entry); |
1327 | return 0; | ||
1324 | } | 1328 | } |
1325 | 1329 | ||
1326 | static void | 1330 | static int |
1327 | delegation_chain_fw_resolution_start (void *cls) | 1331 | delegation_chain_fw_resolution_start (void *cls) |
1328 | { | 1332 | { |
1333 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "Start Forward Resolution...\n"); | ||
1334 | |||
1329 | struct VerifyRequestHandle *vrh = cls; | 1335 | struct VerifyRequestHandle *vrh = cls; |
1330 | struct DelegationSetQueueEntry *ds_entry; | 1336 | struct DelegationSetQueueEntry *ds_entry; |
1331 | struct DelegateRecordEntry *del_entry; | 1337 | struct DelegateRecordEntry *del_entry; |
@@ -1337,7 +1343,7 @@ delegation_chain_fw_resolution_start (void *cls) | |||
1337 | { | 1343 | { |
1338 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No delegations found\n"); | 1344 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "No delegations found\n"); |
1339 | send_lookup_response (vrh); | 1345 | send_lookup_response (vrh); |
1340 | return; | 1346 | return 2; |
1341 | } | 1347 | } |
1342 | 1348 | ||
1343 | // Pre-check with vrh->dele_chain_.. if match issuer_key | 1349 | // Pre-check with vrh->dele_chain_.. if match issuer_key |
@@ -1359,7 +1365,7 @@ delegation_chain_fw_resolution_start (void *cls) | |||
1359 | del_entry->refcount++; | 1365 | del_entry->refcount++; |
1360 | // Found match prematurely | 1366 | // Found match prematurely |
1361 | send_lookup_response (vrh); | 1367 | send_lookup_response (vrh); |
1362 | return; | 1368 | return 1; |
1363 | } | 1369 | } |
1364 | 1370 | ||
1365 | // None match, therefore start for every delegation found a lookup chain | 1371 | // None match, therefore start for every delegation found a lookup chain |
@@ -1409,6 +1415,7 @@ delegation_chain_fw_resolution_start (void *cls) | |||
1409 | &forward_resolution, | 1415 | &forward_resolution, |
1410 | ds_entry); | 1416 | ds_entry); |
1411 | } | 1417 | } |
1418 | return 0; | ||
1412 | } | 1419 | } |
1413 | 1420 | ||
1414 | static int | 1421 | static int |
@@ -1528,7 +1535,8 @@ handle_verify (void *cls, const struct VerifyMessage *v_msg) | |||
1528 | if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo && | 1535 | if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo && |
1529 | GNUNET_CREDENTIAL_FLAG_FORWARD & vrh->resolution_algo) | 1536 | GNUNET_CREDENTIAL_FLAG_FORWARD & vrh->resolution_algo) |
1530 | { | 1537 | { |
1531 | delegation_chain_fw_resolution_start (vrh); | 1538 | if(1 == delegation_chain_fw_resolution_start (vrh)) |
1539 | return; | ||
1532 | delegation_chain_bw_resolution_start (vrh); | 1540 | delegation_chain_bw_resolution_start (vrh); |
1533 | } | 1541 | } |
1534 | else if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo) | 1542 | else if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo) |
@@ -1561,7 +1569,9 @@ delegate_collection_finished (void *cls) | |||
1561 | if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo && | 1569 | if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo && |
1562 | GNUNET_CREDENTIAL_FLAG_FORWARD & vrh->resolution_algo) | 1570 | GNUNET_CREDENTIAL_FLAG_FORWARD & vrh->resolution_algo) |
1563 | { | 1571 | { |
1564 | delegation_chain_fw_resolution_start (vrh); | 1572 | // if premature match found don't start bw resultion |
1573 | if(1 == delegation_chain_fw_resolution_start (vrh)) | ||
1574 | return; | ||
1565 | delegation_chain_bw_resolution_start (vrh); | 1575 | delegation_chain_bw_resolution_start (vrh); |
1566 | } | 1576 | } |
1567 | else if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo) | 1577 | else if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo) |
diff --git a/src/credential/test_credential_bi_and.sh b/src/credential/test_credential_bi_and.sh index 66f0b29f2..a7ed3ce1a 100755 --- a/src/credential/test_credential_bi_and.sh +++ b/src/credential/test_credential_bi_and.sh | |||
@@ -75,7 +75,7 @@ echo $DELS | |||
75 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf | 75 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf |
76 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf | 76 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf |
77 | 77 | ||
78 | RES = $? | 78 | RES=$? |
79 | 79 | ||
80 | # Cleanup properly | 80 | # Cleanup properly |
81 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf | 81 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf |
@@ -87,7 +87,7 @@ gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf | |||
87 | 87 | ||
88 | gnunet-arm -e -c test_credential_lookup.conf | 88 | gnunet-arm -e -c test_credential_lookup.conf |
89 | 89 | ||
90 | if [ $RES == 0 ] | 90 | if [ "$RES" == 0 ] |
91 | then | 91 | then |
92 | exit 0 | 92 | exit 0 |
93 | else | 93 | else |
diff --git a/src/credential/test_credential_bi_and2.sh b/src/credential/test_credential_bi_and2.sh index 8803dfda0..23b55111c 100755 --- a/src/credential/test_credential_bi_and2.sh +++ b/src/credential/test_credential_bi_and2.sh | |||
@@ -72,7 +72,7 @@ echo $DELS | |||
72 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf | 72 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf |
73 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf | 73 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf |
74 | 74 | ||
75 | RES = $? | 75 | RES=$? |
76 | 76 | ||
77 | # Cleanup properly | 77 | # Cleanup properly |
78 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf | 78 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf |
@@ -83,7 +83,7 @@ gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf | |||
83 | 83 | ||
84 | gnunet-arm -e -c test_credential_lookup.conf | 84 | gnunet-arm -e -c test_credential_lookup.conf |
85 | 85 | ||
86 | if [ $RES == 0 ] | 86 | if [ "$RES" == 0 ] |
87 | then | 87 | then |
88 | exit 0 | 88 | exit 0 |
89 | else | 89 | else |
diff --git a/src/credential/test_credential_bi_and3.sh b/src/credential/test_credential_bi_and3.sh index f88c23d46..e2f167622 100755 --- a/src/credential/test_credential_bi_and3.sh +++ b/src/credential/test_credential_bi_and3.sh | |||
@@ -17,7 +17,6 @@ rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` | |||
17 | 17 | ||
18 | 18 | ||
19 | 19 | ||
20 | |||
21 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" | 20 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" |
22 | gnunet-arm -s -c test_credential_lookup.conf | 21 | gnunet-arm -s -c test_credential_lookup.conf |
23 | 22 | ||
@@ -38,6 +37,7 @@ FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print | |||
38 | GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}') | 37 | 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}') | 38 | HKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep h | awk '{print $3}') |
40 | 39 | ||
40 | gnunet-identity -d | ||
41 | # (1) (A.a) <- B.b | 41 | # (1) (A.a) <- B.b |
42 | # (2) (B.b) <- C.c AND G.g | 42 | # (2) (B.b) <- C.c AND G.g |
43 | # (3) C.c <- (D.d) | 43 | # (3) C.c <- (D.d) |
@@ -75,7 +75,7 @@ echo $DELS | |||
75 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf | 75 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf |
76 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf | 76 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf |
77 | 77 | ||
78 | RES = $? | 78 | RES=$? |
79 | 79 | ||
80 | # Cleanup properly | 80 | # Cleanup properly |
81 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf | 81 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf |
@@ -87,7 +87,7 @@ gnunet-namestore -z h -d -n "@" -t DEL -c test_credential_lookup.conf | |||
87 | 87 | ||
88 | gnunet-arm -e -c test_credential_lookup.conf | 88 | gnunet-arm -e -c test_credential_lookup.conf |
89 | 89 | ||
90 | if [ $RES == 0 ] | 90 | if [ "$RES" == 0 ] |
91 | then | 91 | then |
92 | exit 0 | 92 | exit 0 |
93 | else | 93 | else |
diff --git a/src/credential/test_credential_own_and2.sh b/src/credential/test_credential_bi_and4.sh index 9abfac899..c4db5c82a 100755 --- a/src/credential/test_credential_own_and2.sh +++ b/src/credential/test_credential_bi_and4.sh | |||
@@ -63,7 +63,7 @@ echo $DELS | |||
63 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf | 63 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf |
64 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --backward -c test_credential_lookup.conf | 64 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --backward -c test_credential_lookup.conf |
65 | 65 | ||
66 | RES = $? | 66 | RES=$? |
67 | 67 | ||
68 | # Cleanup properly | 68 | # Cleanup properly |
69 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf | 69 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf |
@@ -72,7 +72,7 @@ gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf | |||
72 | 72 | ||
73 | gnunet-arm -e -c test_credential_lookup.conf | 73 | gnunet-arm -e -c test_credential_lookup.conf |
74 | 74 | ||
75 | if [ $RES == 0 ] | 75 | if [ "$RES" == 0 ] |
76 | then | 76 | then |
77 | exit 0 | 77 | exit 0 |
78 | else | 78 | else |
diff --git a/src/credential/test_credential_bi_bw.sh b/src/credential/test_credential_bi_bw.sh index eedcea7eb..3a2043db6 100755 --- a/src/credential/test_credential_bi_bw.sh +++ b/src/credential/test_credential_bi_bw.sh | |||
@@ -66,7 +66,7 @@ echo $DELS | |||
66 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf | 66 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf |
67 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf | 67 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf |
68 | 68 | ||
69 | RES = $? | 69 | RES=$? |
70 | 70 | ||
71 | # Cleanup properly | 71 | # Cleanup properly |
72 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf | 72 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf |
@@ -77,7 +77,7 @@ gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf | |||
77 | 77 | ||
78 | gnunet-arm -e -c test_credential_lookup.conf | 78 | gnunet-arm -e -c test_credential_lookup.conf |
79 | 79 | ||
80 | if [ $RES == 0 ] | 80 | if [ "$RES" == 0 ] |
81 | then | 81 | then |
82 | exit 0 | 82 | exit 0 |
83 | else | 83 | else |
diff --git a/src/credential/test_credential_bi_bw_link.sh b/src/credential/test_credential_bi_bw_link.sh index a8a420d18..86b0e7418 100755 --- a/src/credential/test_credential_bi_bw_link.sh +++ b/src/credential/test_credential_bi_bw_link.sh | |||
@@ -69,7 +69,7 @@ echo $DELS | |||
69 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf | 69 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf |
70 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf | 70 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf |
71 | 71 | ||
72 | RES = $? | 72 | RES=$? |
73 | 73 | ||
74 | # Cleanup properly | 74 | # Cleanup properly |
75 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf | 75 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf |
@@ -81,7 +81,7 @@ gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf | |||
81 | 81 | ||
82 | gnunet-arm -e -c test_credential_lookup.conf | 82 | gnunet-arm -e -c test_credential_lookup.conf |
83 | 83 | ||
84 | if [ $RES == 0 ] | 84 | if [ "$RES" == 0 ] |
85 | then | 85 | then |
86 | exit 0 | 86 | exit 0 |
87 | else | 87 | else |
diff --git a/src/credential/test_credential_bi_bw_link2.sh b/src/credential/test_credential_bi_bw_link2.sh index 1c0d370db..ccb71b880 100755 --- a/src/credential/test_credential_bi_bw_link2.sh +++ b/src/credential/test_credential_bi_bw_link2.sh | |||
@@ -70,7 +70,7 @@ echo $DELS | |||
70 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf | 70 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf |
71 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf | 71 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf |
72 | 72 | ||
73 | RES = $? | 73 | RES=$? |
74 | 74 | ||
75 | # Cleanup properly | 75 | # Cleanup properly |
76 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf | 76 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf |
@@ -82,7 +82,7 @@ gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf | |||
82 | 82 | ||
83 | gnunet-arm -e -c test_credential_lookup.conf | 83 | gnunet-arm -e -c test_credential_lookup.conf |
84 | 84 | ||
85 | if [ $RES == 0 ] | 85 | if [ "$RES" == 0 ] |
86 | then | 86 | then |
87 | exit 0 | 87 | exit 0 |
88 | else | 88 | else |
diff --git a/src/credential/test_credential_bi_fw.sh b/src/credential/test_credential_bi_fw.sh index 2aba82479..9c8f768c5 100755 --- a/src/credential/test_credential_bi_fw.sh +++ b/src/credential/test_credential_bi_fw.sh | |||
@@ -70,7 +70,7 @@ echo $DELS | |||
70 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf | 70 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf |
71 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf | 71 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf |
72 | 72 | ||
73 | RES = $? | 73 | RES=$? |
74 | 74 | ||
75 | # Cleanup properly | 75 | # Cleanup properly |
76 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf | 76 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf |
@@ -82,7 +82,7 @@ gnunet-namestore -z g -d -n "@" -t DEL -c test_credential_lookup.conf | |||
82 | 82 | ||
83 | gnunet-arm -e -c test_credential_lookup.conf | 83 | gnunet-arm -e -c test_credential_lookup.conf |
84 | 84 | ||
85 | if [ $RES == 0 ] | 85 | if [ "$RES" == 0 ] |
86 | then | 86 | then |
87 | exit 0 | 87 | exit 0 |
88 | else | 88 | else |
diff --git a/src/credential/test_credential_issue.sh b/src/credential/test_credential_issue.sh index f06de5d42..833a094e6 100755 --- a/src/credential/test_credential_issue.sh +++ b/src/credential/test_credential_issue.sh | |||
@@ -28,8 +28,10 @@ gnunet-identity -C testissuer -c test_credential_lookup.conf | |||
28 | gnunet-identity -C testsubject -c test_credential_lookup.conf | 28 | gnunet-identity -C testsubject -c test_credential_lookup.conf |
29 | SUBJECT_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testsubject | awk '{print $3}') | 29 | SUBJECT_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testsubject | awk '{print $3}') |
30 | ISSUER_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testissuer | awk '{print $3}') | 30 | ISSUER_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testissuer | awk '{print $3}') |
31 | #TODO1 Get credential and store it with subject (3) | 31 | # Get credential and store it with subject (3) |
32 | CRED=`$DO_TIMEOUT gnunet-credential --issue --ego=testissuer --subject=$SUBJECT_KEY --attribute=$TEST_ATTR --ttl=5m -c test_credential_lookup.conf` | 32 | #CRED=`$DO_TIMEOUT gnunet-credential --issue --ego=testissuer --subject=$SUBJECT_KEY --attribute=$TEST_ATTR --ttl=5m -c test_credential_lookup.conf` |
33 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=testissuer --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf` | ||
34 | |||
33 | STATUS=$? | 35 | STATUS=$? |
34 | 36 | ||
35 | if test $? != 0 | 37 | if test $? != 0 |
@@ -38,7 +40,8 @@ then | |||
38 | exit 1 | 40 | exit 1 |
39 | fi | 41 | fi |
40 | #Try import | 42 | #Try import |
41 | $DO_TIMEOUT gnunet-namestore -a -z testsubject -n c1 -t CRED -V "$CRED" -e 5m -c test_credential_lookup.conf | 43 | $DO_TIMEOUT gnunet-credential --createSubjectSide --ego=testsubject --import "$SIGNED" --private -c test_credential_lookup.conf |
44 | #$DO_TIMEOUT gnunet-namestore -a -z testsubject -n c1 -t CRED -V "$CRED" -e 5m -c test_credential_lookup.conf | ||
42 | RES=$? | 45 | RES=$? |
43 | gnunet-arm -e -c test_credential_lookup.conf | 46 | gnunet-arm -e -c test_credential_lookup.conf |
44 | exit $RES | 47 | exit $RES |
diff --git a/src/credential/test_credential_own.sh b/src/credential/test_credential_own.sh index fa2580a22..b868cdf67 100755 --- a/src/credential/test_credential_own.sh +++ b/src/credential/test_credential_own.sh | |||
@@ -15,10 +15,6 @@ fi | |||
15 | 15 | ||
16 | rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` | 16 | rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` |
17 | 17 | ||
18 | # (1) EPub.discount <- EOrg.preferred | ||
19 | # (2) EOrg.preferred <- StateU.student | ||
20 | # (3) StateU.student <- RegistrarB.student | ||
21 | # (4) RegistrarB.student <- Alice | ||
22 | 18 | ||
23 | 19 | ||
24 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" | 20 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" |
@@ -35,6 +31,12 @@ EKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep e | awk '{print | |||
35 | FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print $3}') | 31 | FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print $3}') |
36 | GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}') | 32 | GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}') |
37 | 33 | ||
34 | ############################################################################################ | ||
35 | # (1) EPub.discount <- EOrg.preferred | ||
36 | # (2) EOrg.preferred <- StateU.student | ||
37 | # (3) StateU.student <- RegistrarB.student | ||
38 | # (4) RegistrarB.student <- Alice | ||
39 | |||
38 | gnunet-identity -C epub -c test_credential_lookup.conf | 40 | gnunet-identity -C epub -c test_credential_lookup.conf |
39 | gnunet-identity -C eorg -c test_credential_lookup.conf | 41 | gnunet-identity -C eorg -c test_credential_lookup.conf |
40 | gnunet-identity -C stateu -c test_credential_lookup.conf | 42 | gnunet-identity -C stateu -c test_credential_lookup.conf |
@@ -54,7 +56,7 @@ STATE_STUD_ATTR="student" | |||
54 | REG_STUD_ATTR="student" | 56 | REG_STUD_ATTR="student" |
55 | END_ATTR="end" | 57 | END_ATTR="end" |
56 | 58 | ||
57 | # FORWARD, subject side stored | 59 | # FORWARD, subject side stored (different constallations) |
58 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=a --attribute="a" --subject="$AKEY b.c" --ttl="2019-12-12 10:00:00"` | 60 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=a --attribute="a" --subject="$AKEY b.c" --ttl="2019-12-12 10:00:00"` |
59 | gnunet-credential --createSubjectSide --ego=a --import "$SIGNED" | 61 | gnunet-credential --createSubjectSide --ego=a --import "$SIGNED" |
60 | gnunet-namestore -D -z a | 62 | gnunet-namestore -D -z a |
@@ -99,11 +101,13 @@ gnunet-credential --createSubjectSide --ego=alice --import "$SIGNED" --private | |||
99 | # Starting to resolve | 101 | # Starting to resolve |
100 | echo "+++ Starting to Resolve +++" | 102 | echo "+++ Starting to Resolve +++" |
101 | 103 | ||
104 | # FORWARD | ||
102 | #DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=g --forward -c test_credential_lookup.conf | paste -d, -s` | 105 | #DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=g --forward -c test_credential_lookup.conf | paste -d, -s` |
103 | #echo $DELS | 106 | #echo $DELS |
104 | #echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate=\'$DELS\' --forward -c test_credential_lookup.conf | 107 | #echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate=\'$DELS\' --forward -c test_credential_lookup.conf |
105 | #RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate="$DELS" --forward -c test_credential_lookup.conf` | 108 | #RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate="$DELS" --forward -c test_credential_lookup.conf` |
106 | 109 | ||
110 | # BACKWARD | ||
107 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$EPUB_KEY --attribute=$DISC_ATTR --ego=alice --backward -c test_credential_lookup.conf | paste -d, -s` | 111 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$EPUB_KEY --attribute=$DISC_ATTR --ego=alice --backward -c test_credential_lookup.conf | paste -d, -s` |
108 | echo $DELS | 112 | echo $DELS |
109 | echo gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf | 113 | echo gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf |
@@ -115,15 +119,16 @@ RES=$? | |||
115 | gnunet-namestore -z epub -d -n $DISC_ATTR -t ATTR -c test_credential_lookup.conf | 119 | gnunet-namestore -z epub -d -n $DISC_ATTR -t ATTR -c test_credential_lookup.conf |
116 | gnunet-namestore -z eorg -d -n $PREF_ATTR -t ATTR -c test_credential_lookup.conf | 120 | gnunet-namestore -z eorg -d -n $PREF_ATTR -t ATTR -c test_credential_lookup.conf |
117 | gnunet-namestore -z stateu -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | 121 | gnunet-namestore -z stateu -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf |
118 | #gnunet-namestore -z a -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | 122 | #gnunet-namestore -z a -d -n "@" -t DEL -c test_credential_lookup.conf |
119 | #gnunet-namestore -z d -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | 123 | #gnunet-namestore -z d -d -n "@" -t DEL -c test_credential_lookup.conf |
120 | #gnunet-namestore -z e -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | 124 | #gnunet-namestore -z e -d -n "@" -t DEL -c test_credential_lookup.conf |
121 | #gnunet-namestore -z f -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | 125 | #gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf |
122 | #gnunet-namestore -z g -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | 126 | #gnunet-namestore -z g -d -n "@" -t DEL -c test_credential_lookup.conf |
127 | |||
123 | 128 | ||
124 | gnunet-arm -e -c test_credential_lookup.conf | 129 | gnunet-arm -e -c test_credential_lookup.conf |
125 | 130 | ||
126 | if [ $RES == 0 ] | 131 | if [ "$RES" == 0 ] |
127 | then | 132 | then |
128 | exit 0 | 133 | exit 0 |
129 | else | 134 | else |
diff --git a/src/credential/test_credential_verify.sh b/src/credential/test_credential_verify.sh index 49d4d4afb..08060f60a 100755 --- a/src/credential/test_credential_verify.sh +++ b/src/credential/test_credential_verify.sh | |||
@@ -42,41 +42,44 @@ DEV_ATTR="developer" | |||
42 | TEST_CREDENTIAL="mygnunetcreds" | 42 | TEST_CREDENTIAL="mygnunetcreds" |
43 | 43 | ||
44 | # (1) A service assigns the attribute "user" to all entities that have been assigned "member" by entities that werde assigned "project" from GNU | 44 | # (1) A service assigns the attribute "user" to all entities that have been assigned "member" by entities that werde assigned "project" from GNU |
45 | gnunet-namestore -p -z service -a -n $USER_ATTR -t ATTR -V "$GNU_KEY $GNU_PROJECT_ATTR.$MEMBER_ATTR" -e 5m -c test_credential_lookup.conf | 45 | gnunet-credential --createIssuerSide --ego=service --attribute="$USER_ATTR" --subject="$GNU_KEY $GNU_PROJECT_ATTR.$MEMBER_ATTR" --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf |
46 | gnunet-namestore -D -z service | ||
46 | 47 | ||
47 | # (2) GNU recognized GNUnet as a GNU project and delegates the "project" attribute | 48 | # (2) GNU recognized GNUnet as a GNU project and delegates the "project" attribute |
48 | gnunet-namestore -p -z gnu -a -n $GNU_PROJECT_ATTR -t ATTR -V "$GNUNET_KEY" -e 5m -c test_credential_lookup.conf | 49 | gnunet-credential --createIssuerSide --ego=gnu --attribute="$GNU_PROJECT_ATTR" --subject="$GNUNET_KEY" --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf |
50 | gnunet-namestore -D -z gnu | ||
49 | 51 | ||
50 | # (3+4) GNUnet assigns the attribute "member" to all entities gnunet has also assigned "developer" or "user" | 52 | # (3+4) GNUnet assigns the attribute "member" to all entities gnunet has also assigned "developer" or "user" |
51 | gnunet-namestore -p -z gnunet -a -n $MEMBER_ATTR -t ATTR -V "$GNUNET_KEY $DEVELOPER_ATTR" -e 5m -c test_credential_lookup.conf | 53 | gnunet-credential --createIssuerSide --ego=gnunet --attribute="$MEMBER_ATTR" --subject="$GNUNET_KEY $DEVELOPER_ATTR" --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf |
52 | gnunet-namestore -p -z gnunet -a -n $MEMBER_ATTR -t ATTR -V "$GNUNET_KEY $USER_ATTR" -e 5m -c test_credential_lookup.conf | 54 | gnunet-credential --createIssuerSide --ego=gnunet --attribute="$MEMBER_ATTR" --subject="$GNUNET_KEY $USER_ATTR" --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf |
55 | gnunet-namestore -D -z gnunet | ||
53 | 56 | ||
54 | # (5) GNUnet issues Alice the credential "developer" | 57 | # (5) GNUnet signes the delegate and Alice stores it |
55 | CRED=`$DO_TIMEOUT gnunet-credential --issue --ego=gnunet --subject=$ALICE_KEY --attribute=$DEV_ATTR --ttl=5m -c test_credential_lookup.conf` | 58 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=gnunet --attribute=$DEV_ATTR --subject=$ALICE_KEY --ttl="2019-12-12 10:00:00"` |
59 | gnunet-credential --createSubjectSide --ego=alice --import "$SIGNED" --private | ||
60 | gnunet-namestore -D -z alice | ||
56 | 61 | ||
57 | # Alice stores the credential under "mygnunetcreds" | 62 | # Starting to resolve |
58 | gnunet-namestore -p -z alice -a -n $TEST_CREDENTIAL -t CRED -V "$CRED" -e 5m -c test_credential_lookup.conf | 63 | echo "+++ Starting to Resolve +++" |
59 | 64 | ||
60 | CREDS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$SERVICE_KEY --attribute=$USER_ATTR --ego=alice -c test_credential_lookup.conf | paste -d, -s` | 65 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$SERVICE_KEY --attribute=$USER_ATTR --ego=alice --backward -c test_credential_lookup.conf | paste -d, -s` |
66 | echo $DELS | ||
67 | echo gnunet-credential --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf | ||
68 | gnunet-credential --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --delegate="$DELS" --backward -c test_credential_lookup.conf | ||
61 | 69 | ||
62 | echo gnunet-credential --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --credential=\'$CREDS\' -c test_credential_lookup.conf | 70 | RES=$? |
63 | #TODO2 Add -z swich like in gnunet-gns | ||
64 | gnunet-credential --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --credential="$CREDS" -c test_credential_lookup.conf | ||
65 | 71 | ||
66 | 72 | # Cleanup properly | |
67 | #TODO cleanup properly | 73 | gnunet-namestore -z alice -d -n "@" -t DEL -c test_credential_lookup.conf |
68 | gnunet-namestore -z alice -d -n $TEST_CREDENTIAL -t CRED -e never -c test_credential_lookup.conf | ||
69 | gnunet-namestore -z gnu -d -n $GNU_PROJECT_ATTR -t ATTR -c test_credential_lookup.conf | 74 | gnunet-namestore -z gnu -d -n $GNU_PROJECT_ATTR -t ATTR -c test_credential_lookup.conf |
70 | gnunet-namestore -z gnunet -d -n $MEMBER_ATTR -t ATTR -c test_credential_lookup.conf | 75 | gnunet-namestore -z gnunet -d -n $MEMBER_ATTR -t ATTR -c test_credential_lookup.conf |
71 | gnunet-namestore -z service -d -n $USER_ATTR -t ATTR -c test_credential_lookup.conf | 76 | gnunet-namestore -z service -d -n $USER_ATTR -t ATTR -c test_credential_lookup.conf |
72 | gnunet-arm -e -c test_credential_lookup.conf | 77 | gnunet-arm -e -c test_credential_lookup.conf |
73 | 78 | ||
74 | if [ "$RES_CRED" != "Failed." ] | 79 | if [ "$RES" == 0 ] |
75 | then | 80 | then |
76 | # TODO: replace echo -e bashism | ||
77 | echo -e "${RES_CRED}" | ||
78 | exit 0 | 81 | exit 0 |
79 | else | 82 | else |
80 | echo "FAIL: Failed to verify credential $RES_CRED." | 83 | echo "FAIL: Failed to verify credential." |
81 | exit 1 | 84 | exit 1 |
82 | fi | 85 | fi |
diff --git a/src/credential/test_credential_verify_and.sh b/src/credential/test_credential_verify_and.sh index aaabcd753..03313c692 100755 --- a/src/credential/test_credential_verify_and.sh +++ b/src/credential/test_credential_verify_and.sh | |||
@@ -17,8 +17,8 @@ rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` | |||
17 | 17 | ||
18 | # (1) Service.user -> GNU.project.member | 18 | # (1) Service.user -> GNU.project.member |
19 | # (2) GNU.project -> GNUnet | 19 | # (2) GNU.project -> GNUnet |
20 | # (3) GNUnet.member -> GNUnet.developer and (4)GNUnet.user | 20 | # (3) GNUnet.member -> GNUnet.developer AND GNUnet.user |
21 | # (5) GNUnet.developer -> Alice | 21 | # (4) GNUnet.developer -> Alice |
22 | 22 | ||
23 | 23 | ||
24 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" | 24 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" |
@@ -39,43 +39,47 @@ MEMBER_ATTR="member" | |||
39 | DEVELOPER_ATTR="developer" | 39 | DEVELOPER_ATTR="developer" |
40 | DEV_ATTR="developer" | 40 | DEV_ATTR="developer" |
41 | TEST_CREDENTIAL="mygnunetcreds" | 41 | TEST_CREDENTIAL="mygnunetcreds" |
42 | set -x | 42 | |
43 | # (1) A service assigns the attribute "user" to all entities that have been assigned "member" by entities that werde assigned "project" from GNU | 43 | # (1) A service assigns the attribute "user" to all entities that have been assigned "member" by entities that werde assigned "project" from GNU |
44 | gnunet-namestore -p -z service -a -n $USER_ATTR -t ATTR -V "$GNU_KEY $GNU_PROJECT_ATTR.$MEMBER_ATTR" -e 5m -c test_credential_lookup.conf | 44 | gnunet-credential --createIssuerSide --ego=service --attribute="$USER_ATTR" --subject="$GNU_KEY $GNU_PROJECT_ATTR.$MEMBER_ATTR" --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf |
45 | gnunet-namestore -D -z service | ||
45 | 46 | ||
46 | # (2) GNU recognized GNUnet as a GNU project and delegates the "project" attribute | 47 | # (2) GNU recognized GNUnet as a GNU project and delegates the "project" attribute |
47 | gnunet-namestore -p -z gnu -a -n $GNU_PROJECT_ATTR -t ATTR -V "$GNUNET_KEY" -e 5m -c test_credential_lookup.conf | 48 | gnunet-credential --createIssuerSide --ego=gnu --attribute="$GNU_PROJECT_ATTR" --subject="$GNUNET_KEY" --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf |
49 | gnunet-namestore -D -z gnu | ||
48 | 50 | ||
49 | # (3+4) GNUnet assigns the attribute "member" to all entities gnunet has also | 51 | # (3+4) GNUnet assigns the attribute "member" to all entities gnunet has also assigned "developer" or "user" |
50 | # assigned "developer" and "user" | 52 | gnunet-credential --createIssuerSide --ego=gnunet --attribute="$MEMBER_ATTR" --subject="$GNUNET_KEY $DEVELOPER_ATTR, $GNUNET_KEY $USER_ATTR" --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf |
51 | gnunet-namestore -p -z gnunet -a -n $MEMBER_ATTR -t ATTR -V "$GNUNET_KEY $DEVELOPER_ATTR,$GNUNET_KEY $USER_ATTR" -e 5m -c test_credential_lookup.conf | 53 | gnunet-namestore -D -z gnunet |
52 | 54 | ||
53 | # (5) GNUnet issues Alice the credential "developer" | 55 | # (5) GNUnet signes the delegates and Alice stores it |
54 | CRED1=`$DO_TIMEOUT gnunet-credential --issue --ego=gnunet --subject=$ALICE_KEY --attribute=$DEV_ATTR --ttl=5m -c test_credential_lookup.conf` | 56 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=gnunet --attribute=$DEV_ATTR --subject=$ALICE_KEY --ttl="2019-12-12 10:00:00"` |
55 | # (5) GNUnet issues Alice the credential "user" | 57 | gnunet-credential --createSubjectSide --ego=alice --import "$SIGNED" --private |
56 | CRED2=`$DO_TIMEOUT gnunet-credential --issue --ego=gnunet --subject=$ALICE_KEY --attribute=$USER_ATTR --ttl=5m -c test_credential_lookup.conf` | 58 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=gnunet --attribute=$USER_ATTR --subject=$ALICE_KEY --ttl="2019-12-12 10:00:00"` |
57 | # Alice stores the credential under "mygnunetcreds" | 59 | gnunet-credential --createSubjectSide --ego=alice --import "$SIGNED" --private |
58 | gnunet-namestore -p -z alice -a -n $TEST_CREDENTIAL -t CRED -V "$CRED1" -e 5m -c test_credential_lookup.conf | 60 | gnunet-namestore -D -z alice |
59 | gnunet-namestore -p -z alice -a -n $TEST_CREDENTIAL -t CRED -V "$CRED2" -e 5m -c test_credential_lookup.conf | ||
60 | 61 | ||
61 | CREDS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$SERVICE_KEY --attribute=$USER_ATTR --ego=alice -c test_credential_lookup.conf | paste -d, -s` | 62 | # Starting to resolve |
63 | echo "+++ Starting to Resolve +++" | ||
62 | 64 | ||
63 | #TODO2 Add -z swich like in gnunet-gns | 65 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$SERVICE_KEY --attribute=$USER_ATTR --ego=alice --backward -c test_credential_lookup.conf | paste -d, -s` |
64 | RES_CRED=`gnunet-credential --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --credential="$CREDS" -c test_credential_lookup.conf` | 66 | echo $DELS |
67 | echo gnunet-credential --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf | ||
68 | gnunet-credential --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --delegate="$DELS" --backward -c test_credential_lookup.conf | ||
65 | 69 | ||
70 | RES=$? | ||
66 | 71 | ||
67 | #TODO cleanup properly | 72 | # Cleanup properly |
68 | gnunet-namestore -z alice -d -n $TEST_CREDENTIAL -t CRED -e never -c test_credential_lookup.conf | 73 | gnunet-namestore -z alice -d -n "@" -t DEL -c test_credential_lookup.conf |
69 | gnunet-namestore -z gnu -d -n $GNU_PROJECT_ATTR -t ATTR -c test_credential_lookup.conf | 74 | gnunet-namestore -z gnu -d -n $GNU_PROJECT_ATTR -t ATTR -c test_credential_lookup.conf |
70 | gnunet-namestore -z gnunet -d -n $MEMBER_ATTR -t ATTR -c test_credential_lookup.conf | 75 | gnunet-namestore -z gnunet -d -n $MEMBER_ATTR -t ATTR -c test_credential_lookup.conf |
71 | gnunet-namestore -z service -d -n $USER_ATTR -t ATTR -c test_credential_lookup.conf | 76 | gnunet-namestore -z service -d -n $USER_ATTR -t ATTR -c test_credential_lookup.conf |
72 | gnunet-arm -e -c test_credential_lookup.conf | 77 | gnunet-arm -e -c test_credential_lookup.conf |
73 | 78 | ||
74 | if [ "$RES_CRED" != "Failed." ] | 79 | if [ "$RES" == 0 ] |
75 | then | 80 | then |
76 | echo -e "${RES_CRED}" | ||
77 | exit 0 | 81 | exit 0 |
78 | else | 82 | else |
79 | echo "FAIL: Failed to verify credential $RES_CRED." | 83 | echo "FAIL: Failed to verify credential $RES_CRED." |
80 | exit 1 | 84 | exit 1 |
81 | fi \ No newline at end of file | 85 | fi |
diff --git a/src/credential/test_credential_verify_simple.sh b/src/credential/test_credential_verify_simple.sh index 41afb47b0..d7657c55f 100755 --- a/src/credential/test_credential_verify_simple.sh +++ b/src/credential/test_credential_verify_simple.sh | |||
@@ -15,7 +15,7 @@ fi | |||
15 | 15 | ||
16 | rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` | 16 | rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` |
17 | 17 | ||
18 | # (3) Isser.user -> Subject | 18 | # (1) Issuer.user -> Subject |
19 | 19 | ||
20 | 20 | ||
21 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" | 21 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" |
@@ -26,27 +26,29 @@ gnunet-identity -C testsubject -c test_credential_lookup.conf | |||
26 | TEST_ATTR="user" | 26 | TEST_ATTR="user" |
27 | SUBJECT_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testsubject | awk '{print $3}') | 27 | SUBJECT_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testsubject | awk '{print $3}') |
28 | ISSUER_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testissuer | awk '{print $3}') | 28 | ISSUER_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testissuer | awk '{print $3}') |
29 | CRED=`$DO_TIMEOUT gnunet-credential --issue --ego=testissuer --subject=$SUBJECT_KEY --attribute=$TEST_ATTR --ttl=5m -c test_credential_lookup.conf` | ||
30 | 29 | ||
31 | TEST_CREDENTIAL="t1" | 30 | # Create delegate (1) |
32 | gnunet-namestore -p -z testsubject -a -n $TEST_CREDENTIAL -t CRED -V "$CRED" -e 5m -c test_credential_lookup.conf | 31 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=testissuer --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf` |
32 | gnunet-credential --createSubjectSide --ego=testsubject --import "$SIGNED" --private | ||
33 | gnunet-namestore -D -z testsubject | ||
33 | 34 | ||
34 | CREDS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --ego=testsubject -c test_credential_lookup.conf | paste -d, -s` | 35 | # Starting to resolve |
36 | echo "+++ Starting to Resolve +++" | ||
35 | 37 | ||
38 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --ego=testsubject -c test_credential_lookup.conf | paste -d, -s` | ||
39 | echo $DELS | ||
40 | gnunet-credential --verify --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --delegate="$DELS" -c test_credential_lookup.conf | ||
36 | 41 | ||
37 | #TODO2 Add -z swich like in gnunet-gns | 42 | RES=$? |
38 | #RES_CRED=`$DO_TIMEOUT gnunet-credential --verify --issuer=$ISSUER_KEY --attribute="$TEST_ATTR" --subject=$SUBJECT_KEY --credential=$TEST_CREDENTIAL -c test_credential_lookup.conf` | ||
39 | RES_CRED=`gnunet-credential --verify --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --credential="$CREDS" -c test_credential_lookup.conf` | ||
40 | 43 | ||
41 | #TODO cleanup properly | 44 | # Cleanup properly |
42 | gnunet-namestore -z testsubject -d -n $TEST_CREDENTIAL -t CRED -e never -c test_credential_lookup.conf | 45 | gnunet-namestore -z testsubject -d -n "@" -t DEL -c test_credential_lookup.conf |
43 | gnunet-identity -D testsubject -c test_credential_lookup.conf | ||
44 | gnunet-arm -e -c test_credential_lookup.conf | 46 | gnunet-arm -e -c test_credential_lookup.conf |
45 | #TODO3 proper test | 47 | |
46 | if [ "$RES_CRED" != "Failed." ] | 48 | if [ "$RES" == 0 ] |
47 | then | 49 | then |
48 | exit 0 | 50 | exit 0 |
49 | else | 51 | else |
50 | echo "FAIL: Failed to verify credential." | 52 | echo "FAIL: Failed to verify credential." |
51 | exit 1 | 53 | exit 1 |
52 | fi | 54 | fi \ No newline at end of file |