aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndreas Ebner <a.e.bner@web.de>2019-09-20 10:49:02 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2019-10-07 12:18:20 +0200
commit3099a7c25cf6b11b0f1909e5a2651d65c0e921c7 (patch)
treec8f10fe3551b35e40d6adcb5e1c68771a12a104e /src
parent5be14856a356b087ad97b479efd9b06172fdfd2f (diff)
downloadgnunet-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.c3
-rw-r--r--src/credential/gnunet-credential.c17
-rw-r--r--src/credential/gnunet-service-credential.c62
-rwxr-xr-xsrc/credential/test_credential_bi_and.sh4
-rwxr-xr-xsrc/credential/test_credential_bi_and2.sh4
-rwxr-xr-xsrc/credential/test_credential_bi_and3.sh6
-rwxr-xr-xsrc/credential/test_credential_bi_and4.sh (renamed from src/credential/test_credential_own_and2.sh)4
-rwxr-xr-xsrc/credential/test_credential_bi_bw.sh4
-rwxr-xr-xsrc/credential/test_credential_bi_bw_link.sh4
-rwxr-xr-xsrc/credential/test_credential_bi_bw_link2.sh4
-rwxr-xr-xsrc/credential/test_credential_bi_fw.sh4
-rwxr-xr-xsrc/credential/test_credential_issue.sh9
-rwxr-xr-xsrc/credential/test_credential_own.sh27
-rwxr-xr-xsrc/credential/test_credential_verify.sh41
-rwxr-xr-xsrc/credential/test_credential_verify_and.sh50
-rwxr-xr-xsrc/credential/test_credential_verify_simple.sh30
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)
487static void 486static void
488add_continuation (void *cls, int32_t success, const char *emsg) 487add_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 */
1250static void 1251static int
1251delegation_chain_bw_resolution_start (void *cls) 1252delegation_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
1326static void 1330static int
1327delegation_chain_fw_resolution_start (void *cls) 1331delegation_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
1414static int 1421static 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
75echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf 75echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf
76gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf 76gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf
77 77
78RES = $? 78RES=$?
79 79
80# Cleanup properly 80# Cleanup properly
81gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf 81gnunet-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
88gnunet-arm -e -c test_credential_lookup.conf 88gnunet-arm -e -c test_credential_lookup.conf
89 89
90if [ $RES == 0 ] 90if [ "$RES" == 0 ]
91then 91then
92 exit 0 92 exit 0
93else 93else
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
72echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf 72echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf
73gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf 73gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf
74 74
75RES = $? 75RES=$?
76 76
77# Cleanup properly 77# Cleanup properly
78gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf 78gnunet-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
84gnunet-arm -e -c test_credential_lookup.conf 84gnunet-arm -e -c test_credential_lookup.conf
85 85
86if [ $RES == 0 ] 86if [ "$RES" == 0 ]
87then 87then
88 exit 0 88 exit 0
89else 89else
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
21which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" 20which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10"
22gnunet-arm -s -c test_credential_lookup.conf 21gnunet-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
38GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}') 37GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}')
39HKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep h | awk '{print $3}') 38HKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep h | awk '{print $3}')
40 39
40gnunet-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
75echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf 75echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_credential_lookup.conf
76gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf 76gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_credential_lookup.conf
77 77
78RES = $? 78RES=$?
79 79
80# Cleanup properly 80# Cleanup properly
81gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf 81gnunet-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
88gnunet-arm -e -c test_credential_lookup.conf 88gnunet-arm -e -c test_credential_lookup.conf
89 89
90if [ $RES == 0 ] 90if [ "$RES" == 0 ]
91then 91then
92 exit 0 92 exit 0
93else 93else
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
63echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf 63echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf
64gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --backward -c test_credential_lookup.conf 64gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --backward -c test_credential_lookup.conf
65 65
66RES = $? 66RES=$?
67 67
68# Cleanup properly 68# Cleanup properly
69gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf 69gnunet-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
73gnunet-arm -e -c test_credential_lookup.conf 73gnunet-arm -e -c test_credential_lookup.conf
74 74
75if [ $RES == 0 ] 75if [ "$RES" == 0 ]
76then 76then
77 exit 0 77 exit 0
78else 78else
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
66echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf 66echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf
67gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf 67gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf
68 68
69RES = $? 69RES=$?
70 70
71# Cleanup properly 71# Cleanup properly
72gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf 72gnunet-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
78gnunet-arm -e -c test_credential_lookup.conf 78gnunet-arm -e -c test_credential_lookup.conf
79 79
80if [ $RES == 0 ] 80if [ "$RES" == 0 ]
81then 81then
82 exit 0 82 exit 0
83else 83else
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
69echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf 69echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf
70gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf 70gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf
71 71
72RES = $? 72RES=$?
73 73
74# Cleanup properly 74# Cleanup properly
75gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf 75gnunet-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
82gnunet-arm -e -c test_credential_lookup.conf 82gnunet-arm -e -c test_credential_lookup.conf
83 83
84if [ $RES == 0 ] 84if [ "$RES" == 0 ]
85then 85then
86 exit 0 86 exit 0
87else 87else
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
70echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf 70echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf
71gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf 71gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf
72 72
73RES = $? 73RES=$?
74 74
75# Cleanup properly 75# Cleanup properly
76gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf 76gnunet-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
83gnunet-arm -e -c test_credential_lookup.conf 83gnunet-arm -e -c test_credential_lookup.conf
84 84
85if [ $RES == 0 ] 85if [ "$RES" == 0 ]
86then 86then
87 exit 0 87 exit 0
88else 88else
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
70echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf 70echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf
71gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf 71gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$GKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf
72 72
73RES = $? 73RES=$?
74 74
75# Cleanup properly 75# Cleanup properly
76gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf 76gnunet-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
83gnunet-arm -e -c test_credential_lookup.conf 83gnunet-arm -e -c test_credential_lookup.conf
84 84
85if [ $RES == 0 ] 85if [ "$RES" == 0 ]
86then 86then
87 exit 0 87 exit 0
88else 88else
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
28gnunet-identity -C testsubject -c test_credential_lookup.conf 28gnunet-identity -C testsubject -c test_credential_lookup.conf
29SUBJECT_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testsubject | awk '{print $3}') 29SUBJECT_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testsubject | awk '{print $3}')
30ISSUER_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testissuer | awk '{print $3}') 30ISSUER_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)
32CRED=`$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`
33SIGNED=`$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
33STATUS=$? 35STATUS=$?
34 36
35if test $? != 0 37if test $? != 0
@@ -38,7 +40,8 @@ then
38 exit 1 40 exit 1
39fi 41fi
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
42RES=$? 45RES=$?
43gnunet-arm -e -c test_credential_lookup.conf 46gnunet-arm -e -c test_credential_lookup.conf
44exit $RES 47exit $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
16rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` 16rm -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
24which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" 20which 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
35FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print $3}') 31FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print $3}')
36GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}') 32GKEY=$(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
38gnunet-identity -C epub -c test_credential_lookup.conf 40gnunet-identity -C epub -c test_credential_lookup.conf
39gnunet-identity -C eorg -c test_credential_lookup.conf 41gnunet-identity -C eorg -c test_credential_lookup.conf
40gnunet-identity -C stateu -c test_credential_lookup.conf 42gnunet-identity -C stateu -c test_credential_lookup.conf
@@ -54,7 +56,7 @@ STATE_STUD_ATTR="student"
54REG_STUD_ATTR="student" 56REG_STUD_ATTR="student"
55END_ATTR="end" 57END_ATTR="end"
56 58
57# FORWARD, subject side stored 59# FORWARD, subject side stored (different constallations)
58SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=a --attribute="a" --subject="$AKEY b.c" --ttl="2019-12-12 10:00:00"` 60SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=a --attribute="a" --subject="$AKEY b.c" --ttl="2019-12-12 10:00:00"`
59gnunet-credential --createSubjectSide --ego=a --import "$SIGNED" 61gnunet-credential --createSubjectSide --ego=a --import "$SIGNED"
60gnunet-namestore -D -z a 62gnunet-namestore -D -z a
@@ -99,11 +101,13 @@ gnunet-credential --createSubjectSide --ego=alice --import "$SIGNED" --private
99# Starting to resolve 101# Starting to resolve
100echo "+++ Starting to Resolve +++" 102echo "+++ 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
107DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$EPUB_KEY --attribute=$DISC_ATTR --ego=alice --backward -c test_credential_lookup.conf | paste -d, -s` 111DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$EPUB_KEY --attribute=$DISC_ATTR --ego=alice --backward -c test_credential_lookup.conf | paste -d, -s`
108echo $DELS 112echo $DELS
109echo gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf 113echo 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=$?
115gnunet-namestore -z epub -d -n $DISC_ATTR -t ATTR -c test_credential_lookup.conf 119gnunet-namestore -z epub -d -n $DISC_ATTR -t ATTR -c test_credential_lookup.conf
116gnunet-namestore -z eorg -d -n $PREF_ATTR -t ATTR -c test_credential_lookup.conf 120gnunet-namestore -z eorg -d -n $PREF_ATTR -t ATTR -c test_credential_lookup.conf
117gnunet-namestore -z stateu -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf 121gnunet-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
124gnunet-arm -e -c test_credential_lookup.conf 129gnunet-arm -e -c test_credential_lookup.conf
125 130
126if [ $RES == 0 ] 131if [ "$RES" == 0 ]
127then 132then
128 exit 0 133 exit 0
129else 134else
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"
42TEST_CREDENTIAL="mygnunetcreds" 42TEST_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
45gnunet-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 45gnunet-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
46gnunet-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
48gnunet-namestore -p -z gnu -a -n $GNU_PROJECT_ATTR -t ATTR -V "$GNUNET_KEY" -e 5m -c test_credential_lookup.conf 49gnunet-credential --createIssuerSide --ego=gnu --attribute="$GNU_PROJECT_ATTR" --subject="$GNUNET_KEY" --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf
50gnunet-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"
51gnunet-namestore -p -z gnunet -a -n $MEMBER_ATTR -t ATTR -V "$GNUNET_KEY $DEVELOPER_ATTR" -e 5m -c test_credential_lookup.conf 53gnunet-credential --createIssuerSide --ego=gnunet --attribute="$MEMBER_ATTR" --subject="$GNUNET_KEY $DEVELOPER_ATTR" --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf
52gnunet-namestore -p -z gnunet -a -n $MEMBER_ATTR -t ATTR -V "$GNUNET_KEY $USER_ATTR" -e 5m -c test_credential_lookup.conf 54gnunet-credential --createIssuerSide --ego=gnunet --attribute="$MEMBER_ATTR" --subject="$GNUNET_KEY $USER_ATTR" --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf
55gnunet-namestore -D -z gnunet
53 56
54# (5) GNUnet issues Alice the credential "developer" 57# (5) GNUnet signes the delegate and Alice stores it
55CRED=`$DO_TIMEOUT gnunet-credential --issue --ego=gnunet --subject=$ALICE_KEY --attribute=$DEV_ATTR --ttl=5m -c test_credential_lookup.conf` 58SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=gnunet --attribute=$DEV_ATTR --subject=$ALICE_KEY --ttl="2019-12-12 10:00:00"`
59gnunet-credential --createSubjectSide --ego=alice --import "$SIGNED" --private
60gnunet-namestore -D -z alice
56 61
57# Alice stores the credential under "mygnunetcreds" 62# Starting to resolve
58gnunet-namestore -p -z alice -a -n $TEST_CREDENTIAL -t CRED -V "$CRED" -e 5m -c test_credential_lookup.conf 63echo "+++ Starting to Resolve +++"
59 64
60CREDS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$SERVICE_KEY --attribute=$USER_ATTR --ego=alice -c test_credential_lookup.conf | paste -d, -s` 65DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$SERVICE_KEY --attribute=$USER_ATTR --ego=alice --backward -c test_credential_lookup.conf | paste -d, -s`
66echo $DELS
67echo gnunet-credential --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf
68gnunet-credential --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --delegate="$DELS" --backward -c test_credential_lookup.conf
61 69
62echo gnunet-credential --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --credential=\'$CREDS\' -c test_credential_lookup.conf 70RES=$?
63#TODO2 Add -z swich like in gnunet-gns
64gnunet-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 73gnunet-namestore -z alice -d -n "@" -t DEL -c test_credential_lookup.conf
68gnunet-namestore -z alice -d -n $TEST_CREDENTIAL -t CRED -e never -c test_credential_lookup.conf
69gnunet-namestore -z gnu -d -n $GNU_PROJECT_ATTR -t ATTR -c test_credential_lookup.conf 74gnunet-namestore -z gnu -d -n $GNU_PROJECT_ATTR -t ATTR -c test_credential_lookup.conf
70gnunet-namestore -z gnunet -d -n $MEMBER_ATTR -t ATTR -c test_credential_lookup.conf 75gnunet-namestore -z gnunet -d -n $MEMBER_ATTR -t ATTR -c test_credential_lookup.conf
71gnunet-namestore -z service -d -n $USER_ATTR -t ATTR -c test_credential_lookup.conf 76gnunet-namestore -z service -d -n $USER_ATTR -t ATTR -c test_credential_lookup.conf
72gnunet-arm -e -c test_credential_lookup.conf 77gnunet-arm -e -c test_credential_lookup.conf
73 78
74if [ "$RES_CRED" != "Failed." ] 79if [ "$RES" == 0 ]
75then 80then
76 # TODO: replace echo -e bashism
77 echo -e "${RES_CRED}"
78 exit 0 81 exit 0
79else 82else
80 echo "FAIL: Failed to verify credential $RES_CRED." 83 echo "FAIL: Failed to verify credential."
81 exit 1 84 exit 1
82fi 85fi
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
24which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" 24which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
@@ -39,43 +39,47 @@ MEMBER_ATTR="member"
39DEVELOPER_ATTR="developer" 39DEVELOPER_ATTR="developer"
40DEV_ATTR="developer" 40DEV_ATTR="developer"
41TEST_CREDENTIAL="mygnunetcreds" 41TEST_CREDENTIAL="mygnunetcreds"
42set -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
44gnunet-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 44gnunet-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
45gnunet-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
47gnunet-namestore -p -z gnu -a -n $GNU_PROJECT_ATTR -t ATTR -V "$GNUNET_KEY" -e 5m -c test_credential_lookup.conf 48gnunet-credential --createIssuerSide --ego=gnu --attribute="$GNU_PROJECT_ATTR" --subject="$GNUNET_KEY" --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf
49gnunet-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" 52gnunet-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
51gnunet-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 53gnunet-namestore -D -z gnunet
52 54
53# (5) GNUnet issues Alice the credential "developer" 55# (5) GNUnet signes the delegates and Alice stores it
54CRED1=`$DO_TIMEOUT gnunet-credential --issue --ego=gnunet --subject=$ALICE_KEY --attribute=$DEV_ATTR --ttl=5m -c test_credential_lookup.conf` 56SIGNED=`$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" 57gnunet-credential --createSubjectSide --ego=alice --import "$SIGNED" --private
56CRED2=`$DO_TIMEOUT gnunet-credential --issue --ego=gnunet --subject=$ALICE_KEY --attribute=$USER_ATTR --ttl=5m -c test_credential_lookup.conf` 58SIGNED=`$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" 59gnunet-credential --createSubjectSide --ego=alice --import "$SIGNED" --private
58gnunet-namestore -p -z alice -a -n $TEST_CREDENTIAL -t CRED -V "$CRED1" -e 5m -c test_credential_lookup.conf 60gnunet-namestore -D -z alice
59gnunet-namestore -p -z alice -a -n $TEST_CREDENTIAL -t CRED -V "$CRED2" -e 5m -c test_credential_lookup.conf
60 61
61CREDS=`$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
63echo "+++ Starting to Resolve +++"
62 64
63#TODO2 Add -z swich like in gnunet-gns 65DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$SERVICE_KEY --attribute=$USER_ATTR --ego=alice --backward -c test_credential_lookup.conf | paste -d, -s`
64RES_CRED=`gnunet-credential --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --credential="$CREDS" -c test_credential_lookup.conf` 66echo $DELS
67echo gnunet-credential --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf
68gnunet-credential --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --delegate="$DELS" --backward -c test_credential_lookup.conf
65 69
70RES=$?
66 71
67#TODO cleanup properly 72# Cleanup properly
68gnunet-namestore -z alice -d -n $TEST_CREDENTIAL -t CRED -e never -c test_credential_lookup.conf 73gnunet-namestore -z alice -d -n "@" -t DEL -c test_credential_lookup.conf
69gnunet-namestore -z gnu -d -n $GNU_PROJECT_ATTR -t ATTR -c test_credential_lookup.conf 74gnunet-namestore -z gnu -d -n $GNU_PROJECT_ATTR -t ATTR -c test_credential_lookup.conf
70gnunet-namestore -z gnunet -d -n $MEMBER_ATTR -t ATTR -c test_credential_lookup.conf 75gnunet-namestore -z gnunet -d -n $MEMBER_ATTR -t ATTR -c test_credential_lookup.conf
71gnunet-namestore -z service -d -n $USER_ATTR -t ATTR -c test_credential_lookup.conf 76gnunet-namestore -z service -d -n $USER_ATTR -t ATTR -c test_credential_lookup.conf
72gnunet-arm -e -c test_credential_lookup.conf 77gnunet-arm -e -c test_credential_lookup.conf
73 78
74if [ "$RES_CRED" != "Failed." ] 79if [ "$RES" == 0 ]
75then 80then
76 echo -e "${RES_CRED}"
77 exit 0 81 exit 0
78else 82else
79 echo "FAIL: Failed to verify credential $RES_CRED." 83 echo "FAIL: Failed to verify credential $RES_CRED."
80 exit 1 84 exit 1
81fi \ No newline at end of file 85fi
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
16rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` 16rm -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
21which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" 21which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
@@ -26,27 +26,29 @@ gnunet-identity -C testsubject -c test_credential_lookup.conf
26TEST_ATTR="user" 26TEST_ATTR="user"
27SUBJECT_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testsubject | awk '{print $3}') 27SUBJECT_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testsubject | awk '{print $3}')
28ISSUER_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testissuer | awk '{print $3}') 28ISSUER_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testissuer | awk '{print $3}')
29CRED=`$DO_TIMEOUT gnunet-credential --issue --ego=testissuer --subject=$SUBJECT_KEY --attribute=$TEST_ATTR --ttl=5m -c test_credential_lookup.conf`
30 29
31TEST_CREDENTIAL="t1" 30# Create delegate (1)
32gnunet-namestore -p -z testsubject -a -n $TEST_CREDENTIAL -t CRED -V "$CRED" -e 5m -c test_credential_lookup.conf 31SIGNED=`$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`
32gnunet-credential --createSubjectSide --ego=testsubject --import "$SIGNED" --private
33gnunet-namestore -D -z testsubject
33 34
34CREDS=`$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
36echo "+++ Starting to Resolve +++"
35 37
38DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --ego=testsubject -c test_credential_lookup.conf | paste -d, -s`
39echo $DELS
40gnunet-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 42RES=$?
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`
39RES_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
42gnunet-namestore -z testsubject -d -n $TEST_CREDENTIAL -t CRED -e never -c test_credential_lookup.conf 45gnunet-namestore -z testsubject -d -n "@" -t DEL -c test_credential_lookup.conf
43gnunet-identity -D testsubject -c test_credential_lookup.conf
44gnunet-arm -e -c test_credential_lookup.conf 46gnunet-arm -e -c test_credential_lookup.conf
45#TODO3 proper test 47
46if [ "$RES_CRED" != "Failed." ] 48if [ "$RES" == 0 ]
47then 49then
48 exit 0 50 exit 0
49else 51else
50 echo "FAIL: Failed to verify credential." 52 echo "FAIL: Failed to verify credential."
51 exit 1 53 exit 1
52fi 54fi \ No newline at end of file