diff options
author | Andreas Ebner <pansy007@googlemail.com> | 2019-08-11 17:04:00 +0200 |
---|---|---|
committer | Schanzenbach, Martin <mschanzenbach@posteo.de> | 2019-10-07 12:17:28 +0200 |
commit | 7b749c91759eb75eda5cac1e02954cc82ef27db3 (patch) | |
tree | 7e3e1cde1638073d764be9399f52b04937cdbe14 /src/credential | |
parent | 33525da20575ba0149d1c6bcaac74e52d4e0ddd7 (diff) | |
download | gnunet-7b749c91759eb75eda5cac1e02954cc82ef27db3.tar.gz gnunet-7b749c91759eb75eda5cac1e02954cc82ef27db3.zip |
Unfinished implementation of bidirectional search:
- queue to add all currently found nodes
- backward_resolution implementation of what to do when you find a matching one
- new test for bidirecitonal search
- still a lot to do / still has a lot of prints and comments that need to be removed
Diffstat (limited to 'src/credential')
-rw-r--r-- | src/credential/gnunet-service-credential.c | 193 | ||||
-rwxr-xr-x | src/credential/test_credential_bi.sh | 90 | ||||
-rwxr-xr-x | src/credential/test_credential_own.sh | 1 |
3 files changed, 270 insertions, 14 deletions
diff --git a/src/credential/gnunet-service-credential.c b/src/credential/gnunet-service-credential.c index 41f4f64d6..9de16bf72 100644 --- a/src/credential/gnunet-service-credential.c +++ b/src/credential/gnunet-service-credential.c | |||
@@ -243,6 +243,11 @@ struct DelegationSetQueueEntry | |||
243 | * The delegation chain entry | 243 | * The delegation chain entry |
244 | */ | 244 | */ |
245 | struct DelegationChainEntry *delegation_chain_entry; | 245 | struct DelegationChainEntry *delegation_chain_entry; |
246 | |||
247 | /** | ||
248 | * True if added by backward resolution | ||
249 | */ | ||
250 | bool from_bw; | ||
246 | }; | 251 | }; |
247 | 252 | ||
248 | 253 | ||
@@ -369,6 +374,10 @@ static struct GNUNET_STATISTICS_Handle *statistics; | |||
369 | */ | 374 | */ |
370 | static struct GNUNET_GNS_Handle *gns; | 375 | static struct GNUNET_GNS_Handle *gns; |
371 | 376 | ||
377 | //TODO vrh dependent | ||
378 | static struct DelegationSetQueueEntry *dsq_head; | ||
379 | static struct DelegationSetQueueEntry *dsq_tail; | ||
380 | |||
372 | 381 | ||
373 | /** | 382 | /** |
374 | * Handle to namestore service | 383 | * Handle to namestore service |
@@ -564,7 +573,8 @@ send_lookup_response (struct VerifyRequestHandle *vrh) | |||
564 | 573 | ||
565 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (vrh->client), env); | 574 | GNUNET_MQ_send (GNUNET_SERVICE_client_get_mq (vrh->client), env); |
566 | GNUNET_CONTAINER_DLL_remove (vrh_head, vrh_tail, vrh); | 575 | GNUNET_CONTAINER_DLL_remove (vrh_head, vrh_tail, vrh); |
567 | cleanup_handle (vrh); | 576 | //TODO fix cleanup with bidirectional |
577 | //cleanup_handle (vrh); | ||
568 | 578 | ||
569 | GNUNET_STATISTICS_update (statistics, | 579 | GNUNET_STATISTICS_update (statistics, |
570 | "Completed verifications", | 580 | "Completed verifications", |
@@ -806,6 +816,42 @@ forward_resolution (void *cls, | |||
806 | } | 816 | } |
807 | } | 817 | } |
808 | 818 | ||
819 | // TODO testing area | ||
820 | |||
821 | // Check list | ||
822 | for (struct DelegationSetQueueEntry *del_entry = dsq_head; | ||
823 | del_entry != NULL; | ||
824 | del_entry = del_entry->next) | ||
825 | { | ||
826 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"--fw-------- %s.%s <- %s.%s\n", | ||
827 | GNUNET_CRYPTO_ecdsa_public_key_to_string(&del_entry->delegation_chain_entry->issuer_key), | ||
828 | del_entry->delegation_chain_entry->issuer_attribute, | ||
829 | GNUNET_CRYPTO_ecdsa_public_key_to_string(&del_entry->delegation_chain_entry->subject_key), | ||
830 | del_entry->delegation_chain_entry->subject_attribute); | ||
831 | |||
832 | // only check entries not added by forward algorithm | ||
833 | if(del_entry->from_bw) | ||
834 | { | ||
835 | // key of list entry matches actual key | ||
836 | if (0 == memcmp (&del_entry->delegation_chain_entry->subject_key, | ||
837 | &ds_entry->delegation_chain_entry->issuer_key, | ||
838 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey))) | ||
839 | { | ||
840 | // compare entry subject attributes to this trailer (iss attr + old trailer) | ||
841 | if (0 == strcmp (del_entry->delegation_chain_entry->subject_attribute, | ||
842 | ds_entry->attr_trailer)) | ||
843 | { | ||
844 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"--fw-------- Found match with above!\n"); | ||
845 | send_lookup_response (vrh); | ||
846 | return; | ||
847 | } | ||
848 | } | ||
849 | } | ||
850 | } | ||
851 | // No crossmatch/bidirectional result, add this ds_entry for the bw algo to match | ||
852 | ds_entry->from_bw = false; | ||
853 | GNUNET_CONTAINER_DLL_insert (dsq_head, dsq_tail, ds_entry); | ||
854 | |||
809 | // Starting a new GNS lookup | 855 | // Starting a new GNS lookup |
810 | vrh->pending_lookups++; | 856 | vrh->pending_lookups++; |
811 | ds_entry->handle = vrh; | 857 | ds_entry->handle = vrh; |
@@ -833,6 +879,17 @@ forward_resolution (void *cls, | |||
833 | } | 879 | } |
834 | 880 | ||
835 | static void | 881 | static void |
882 | print_deleset(struct DelegationSetQueueEntry *dsentry, char* text) | ||
883 | { | ||
884 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"%s %s.%s <- %s.%s\n", | ||
885 | text, | ||
886 | GNUNET_CRYPTO_ecdsa_public_key_to_string(&dsentry->delegation_chain_entry->issuer_key), | ||
887 | dsentry->delegation_chain_entry->issuer_attribute, | ||
888 | GNUNET_CRYPTO_ecdsa_public_key_to_string(&dsentry->delegation_chain_entry->subject_key), | ||
889 | dsentry->delegation_chain_entry->subject_attribute); | ||
890 | } | ||
891 | |||
892 | static void | ||
836 | backward_resolution (void *cls, | 893 | backward_resolution (void *cls, |
837 | uint32_t rd_count, | 894 | uint32_t rd_count, |
838 | const struct GNUNET_GNSRECORD_Data *rd) | 895 | const struct GNUNET_GNSRECORD_Data *rd) |
@@ -934,14 +991,15 @@ backward_resolution (void *cls, | |||
934 | dq_entry->set_entries_tail, | 991 | dq_entry->set_entries_tail, |
935 | ds_entry); | 992 | ds_entry); |
936 | 993 | ||
937 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Checking for cred match\n"); | ||
938 | /** | 994 | /** |
939 | * Check if this delegation already matches one of our credentials | 995 | * Check if this delegation already matches one of our credentials |
940 | */ | 996 | */ |
997 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Checking for cred match\n"); | ||
998 | |||
941 | for (del_pointer = vrh->del_chain_head; del_pointer != NULL; | 999 | for (del_pointer = vrh->del_chain_head; del_pointer != NULL; |
942 | del_pointer = del_pointer->next) | 1000 | del_pointer = del_pointer->next) |
943 | { | 1001 | { |
944 | // If key and attribute match credential continue and backtrack | 1002 | // If key and attribute match credential: continue and backtrack |
945 | if (0 != memcmp (&set->subject_key, | 1003 | if (0 != memcmp (&set->subject_key, |
946 | &del_pointer->delegate->issuer_key, | 1004 | &del_pointer->delegate->issuer_key, |
947 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey))) | 1005 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey))) |
@@ -956,7 +1014,9 @@ backward_resolution (void *cls, | |||
956 | continue; | 1014 | continue; |
957 | 1015 | ||
958 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found issuer\n"); | 1016 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found issuer\n"); |
1017 | // increase refcount of the start delegation | ||
959 | del_pointer->refcount++; | 1018 | del_pointer->refcount++; |
1019 | |||
960 | // Backtrack | 1020 | // Backtrack |
961 | for (tmp_set = ds_entry; NULL != tmp_set->parent_queue_entry; | 1021 | for (tmp_set = ds_entry; NULL != tmp_set->parent_queue_entry; |
962 | tmp_set = tmp_set->parent_queue_entry->parent_set) | 1022 | tmp_set = tmp_set->parent_queue_entry->parent_set) |
@@ -973,6 +1033,7 @@ backward_resolution (void *cls, | |||
973 | break; | 1033 | break; |
974 | } | 1034 | } |
975 | 1035 | ||
1036 | // if the break above is not called the condition of the for is met | ||
976 | if (NULL == tmp_set->parent_queue_entry) | 1037 | if (NULL == tmp_set->parent_queue_entry) |
977 | { | 1038 | { |
978 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All solutions found\n"); | 1039 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "All solutions found\n"); |
@@ -983,10 +1044,11 @@ backward_resolution (void *cls, | |||
983 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Not all solutions found yet.\n"); | 1044 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Not all solutions found yet.\n"); |
984 | continue; | 1045 | continue; |
985 | } | 1046 | } |
1047 | |||
986 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1048 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
987 | "Building new lookup request from %s\n", | 1049 | "Building new lookup request from %s\n", |
988 | ds_entry->unresolved_attribute_delegation); | 1050 | ds_entry->unresolved_attribute_delegation); |
989 | // Continue with backward resolution | 1051 | // Continue with next/new backward resolution |
990 | char issuer_attribute_name[strlen ( | 1052 | char issuer_attribute_name[strlen ( |
991 | ds_entry->unresolved_attribute_delegation) + | 1053 | ds_entry->unresolved_attribute_delegation) + |
992 | 1]; | 1054 | 1]; |
@@ -1011,6 +1073,106 @@ backward_resolution (void *cls, | |||
1011 | ds_entry->attr_trailer = GNUNET_strdup (next_attr); | 1073 | ds_entry->attr_trailer = GNUNET_strdup (next_attr); |
1012 | } | 1074 | } |
1013 | 1075 | ||
1076 | |||
1077 | // TODO testing area | ||
1078 | // Check list | ||
1079 | for (struct DelegationSetQueueEntry *del_entry = dsq_head; | ||
1080 | del_entry != NULL; | ||
1081 | del_entry = del_entry->next) | ||
1082 | { | ||
1083 | print_deleset(del_entry, "-----bw----- "); | ||
1084 | |||
1085 | // only check entries not added by forward algorithm | ||
1086 | if(!del_entry->from_bw) | ||
1087 | { | ||
1088 | // key of list entry matches actual key | ||
1089 | if (0 == memcmp (&del_entry->delegation_chain_entry->issuer_key, | ||
1090 | &ds_entry->delegation_chain_entry->subject_key, | ||
1091 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey))) | ||
1092 | { | ||
1093 | // compare entry subject attributes to this trailer (iss attr + old trailer) | ||
1094 | if (0 == strcmp (del_entry->attr_trailer, | ||
1095 | ds_entry->delegation_chain_entry->subject_attribute)) | ||
1096 | { | ||
1097 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,"--bw-------- Found match with above!\n"); | ||
1098 | |||
1099 | //TODO parents are not set correctly, for FW parents are going down in the chain | ||
1100 | // and for BW parents are going up | ||
1101 | // therefore: parent fixing needs to be done and then the stuff from above | ||
1102 | // backtrack(required solutions) and refcount++ | ||
1103 | // might need some functions cuz its getting real big in here | ||
1104 | |||
1105 | struct DelegationSetQueueEntry *old_fw_parent; | ||
1106 | struct DelegationSetQueueEntry *fw_entry = del_entry; | ||
1107 | struct DelegationSetQueueEntry *bw_entry = ds_entry; | ||
1108 | // parentset and add | ||
1109 | while(NULL != fw_entry->parent_queue_entry) | ||
1110 | { | ||
1111 | print_deleset(fw_entry, "-----in while----- "); | ||
1112 | old_fw_parent = fw_entry->parent_queue_entry->parent_set; | ||
1113 | // set parent | ||
1114 | fw_entry->parent_queue_entry->parent_set = bw_entry; | ||
1115 | |||
1116 | bw_entry = fw_entry; | ||
1117 | fw_entry = old_fw_parent; | ||
1118 | } | ||
1119 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "NACH WHILE\n"); | ||
1120 | // set last entry of chain as actual ds_entry | ||
1121 | ds_entry = bw_entry; | ||
1122 | // set refcount, loop all delegations | ||
1123 | for (del_pointer = vrh->del_chain_head; del_pointer != NULL; | ||
1124 | del_pointer = del_pointer->next) | ||
1125 | { | ||
1126 | if (0 != memcmp (&ds_entry->delegation_chain_entry->subject_key, | ||
1127 | &del_pointer->delegate->issuer_key, | ||
1128 | sizeof (struct GNUNET_CRYPTO_EcdsaPublicKey))) | ||
1129 | continue; | ||
1130 | if (0 != strcmp (ds_entry->delegation_chain_entry->subject_attribute, | ||
1131 | del_pointer->delegate->issuer_attribute)) | ||
1132 | continue; | ||
1133 | |||
1134 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Found delegate.\n"); | ||
1135 | // increase refcount of the start delegation | ||
1136 | del_pointer->refcount++; | ||
1137 | } | ||
1138 | // backtrack | ||
1139 | for (tmp_set = ds_entry; NULL != tmp_set->parent_queue_entry; | ||
1140 | tmp_set = tmp_set->parent_queue_entry->parent_set) | ||
1141 | { | ||
1142 | //TODO set refcount | ||
1143 | print_deleset(tmp_set, "-----ENDSET----- "); | ||
1144 | tmp_set->parent_queue_entry->required_solutions--; | ||
1145 | |||
1146 | // add new found entry to vrh | ||
1147 | vrh->delegation_chain_size++; | ||
1148 | GNUNET_CONTAINER_DLL_insert (vrh->delegation_chain_head, | ||
1149 | vrh->delegation_chain_tail, | ||
1150 | tmp_set->delegation_chain_entry); | ||
1151 | |||
1152 | // if one node on the path still needs solutions, this current | ||
1153 | // patch cannot fullfil the conditions and therefore stops here | ||
1154 | // however, it is in the vrh and can be used by the other paths | ||
1155 | // related to this path/collection/verification | ||
1156 | if (0 < tmp_set->parent_queue_entry->required_solutions) | ||
1157 | { | ||
1158 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Chain requires more solutions, waiting...\n"); | ||
1159 | return; | ||
1160 | } | ||
1161 | } | ||
1162 | GNUNET_log (GNUNET_ERROR_TYPE_ERROR, "NACH FOR\n"); | ||
1163 | |||
1164 | send_lookup_response (vrh); | ||
1165 | return; | ||
1166 | } | ||
1167 | } | ||
1168 | } | ||
1169 | } | ||
1170 | // No crossmatch/bidirectional result, add this ds_entry for the bw algo to match | ||
1171 | ds_entry->from_bw = true; | ||
1172 | GNUNET_CONTAINER_DLL_insert (dsq_head, dsq_tail, ds_entry); | ||
1173 | |||
1174 | |||
1175 | |||
1014 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, | 1176 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, |
1015 | "Looking up %s\n", | 1177 | "Looking up %s\n", |
1016 | ds_entry->lookup_attribute); | 1178 | ds_entry->lookup_attribute); |
@@ -1305,7 +1467,12 @@ handle_verify (void *cls, const struct VerifyMessage *v_msg) | |||
1305 | } | 1467 | } |
1306 | 1468 | ||
1307 | // Switch resolution algo | 1469 | // Switch resolution algo |
1308 | if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo) | 1470 | if(GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo && GNUNET_CREDENTIAL_FLAG_FORWARD & vrh->resolution_algo) |
1471 | { | ||
1472 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "--------BOTH\n"); | ||
1473 | delegation_chain_fw_resolution_start (vrh); | ||
1474 | delegation_chain_bw_resolution_start (vrh); | ||
1475 | } else if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo) | ||
1309 | { | 1476 | { |
1310 | delegation_chain_bw_resolution_start (vrh); | 1477 | delegation_chain_bw_resolution_start (vrh); |
1311 | } | 1478 | } |
@@ -1313,10 +1480,6 @@ handle_verify (void *cls, const struct VerifyMessage *v_msg) | |||
1313 | { | 1480 | { |
1314 | delegation_chain_fw_resolution_start (vrh); | 1481 | delegation_chain_fw_resolution_start (vrh); |
1315 | } | 1482 | } |
1316 | else | ||
1317 | { | ||
1318 | //TODO | ||
1319 | } | ||
1320 | } | 1483 | } |
1321 | 1484 | ||
1322 | static void | 1485 | static void |
@@ -1335,7 +1498,13 @@ delegate_collection_finished (void *cls) | |||
1335 | struct VerifyRequestHandle *vrh = cls; | 1498 | struct VerifyRequestHandle *vrh = cls; |
1336 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Done collecting delegates.\n"); | 1499 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "Done collecting delegates.\n"); |
1337 | 1500 | ||
1338 | if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo) | 1501 | //TODO correct calls |
1502 | if(GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo && GNUNET_CREDENTIAL_FLAG_FORWARD & vrh->resolution_algo) | ||
1503 | { | ||
1504 | GNUNET_log (GNUNET_ERROR_TYPE_DEBUG, "--------BOTH\n"); | ||
1505 | delegation_chain_fw_resolution_start (vrh); | ||
1506 | delegation_chain_bw_resolution_start (vrh); | ||
1507 | }else if (GNUNET_CREDENTIAL_FLAG_BACKWARD & vrh->resolution_algo) | ||
1339 | { | 1508 | { |
1340 | delegation_chain_bw_resolution_start (vrh); | 1509 | delegation_chain_bw_resolution_start (vrh); |
1341 | } | 1510 | } |
@@ -1343,10 +1512,6 @@ delegate_collection_finished (void *cls) | |||
1343 | { | 1512 | { |
1344 | delegation_chain_fw_resolution_start (vrh); | 1513 | delegation_chain_fw_resolution_start (vrh); |
1345 | } | 1514 | } |
1346 | else | ||
1347 | { | ||
1348 | //TODO | ||
1349 | } | ||
1350 | } | 1515 | } |
1351 | 1516 | ||
1352 | static void | 1517 | static void |
diff --git a/src/credential/test_credential_bi.sh b/src/credential/test_credential_bi.sh new file mode 100755 index 000000000..2b8cfc452 --- /dev/null +++ b/src/credential/test_credential_bi.sh | |||
@@ -0,0 +1,90 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT | ||
3 | |||
4 | LOCATION=$(which gnunet-config) | ||
5 | if [ -z $LOCATION ] | ||
6 | then | ||
7 | LOCATION="gnunet-config" | ||
8 | fi | ||
9 | $LOCATION --version 1> /dev/null | ||
10 | if test $? != 0 | ||
11 | then | ||
12 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | ||
13 | exit 77 | ||
14 | fi | ||
15 | |||
16 | rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` | ||
17 | |||
18 | |||
19 | |||
20 | |||
21 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" | ||
22 | gnunet-arm -s -c test_credential_lookup.conf | ||
23 | |||
24 | gnunet-identity -C a -c test_credential_lookup.conf | ||
25 | gnunet-identity -C b -c test_credential_lookup.conf | ||
26 | gnunet-identity -C c -c test_credential_lookup.conf | ||
27 | gnunet-identity -C d -c test_credential_lookup.conf | ||
28 | gnunet-identity -C e -c test_credential_lookup.conf | ||
29 | gnunet-identity -C f -c test_credential_lookup.conf | ||
30 | gnunet-identity -C g -c test_credential_lookup.conf | ||
31 | AKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep a | awk '{print $3}') | ||
32 | BKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep b | awk '{print $3}') | ||
33 | CKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep c | awk '{print $3}') | ||
34 | DKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep d | awk '{print $3}') | ||
35 | EKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep e | awk '{print $3}') | ||
36 | FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print $3}') | ||
37 | GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}') | ||
38 | |||
39 | # (1) (A.a) <- B.b | ||
40 | # (2) (B.b) <- C.c | ||
41 | # (3) C.c <- (D.D) | ||
42 | # (4) D.d <- (E.e) | ||
43 | # (5) E.e <- (F) | ||
44 | |||
45 | # BIDIRECTIONAL | ||
46 | gnunet-credential --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_credential_lookup.conf | ||
47 | gnunet-namestore -D -z a | ||
48 | gnunet-credential --createIssuerSide --ego=b --attribute="b" --subject="$CKEY c" --ttl=5m -c test_credential_lookup.conf | ||
49 | gnunet-namestore -D -z b | ||
50 | |||
51 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=c --attribute="c" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` | ||
52 | gnunet-credential --createSubjectSide --ego=d --import "$SIGNED" | ||
53 | gnunet-namestore -D -z d | ||
54 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=d --attribute="d" --subject="$EKEY e" --ttl="2019-12-12 10:00:00"` | ||
55 | gnunet-credential --createSubjectSide --ego=e --import "$SIGNED" | ||
56 | gnunet-namestore -D -z e | ||
57 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=e --attribute="e" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` | ||
58 | gnunet-credential --createSubjectSide --ego=f --import "$SIGNED" --private | ||
59 | gnunet-namestore -D -z f | ||
60 | |||
61 | # Starting to resolve | ||
62 | echo "+++ Starting to Resolve +++" | ||
63 | |||
64 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s` | ||
65 | echo $DELS | ||
66 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf | ||
67 | RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf` | ||
68 | |||
69 | # Cleanup properly | ||
70 | gnunet-namestore -z epub -d -n $DISC_ATTR -t ATTR -c test_credential_lookup.conf | ||
71 | gnunet-namestore -z eorg -d -n $PREF_ATTR -t ATTR -c test_credential_lookup.conf | ||
72 | gnunet-namestore -z stateu -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
73 | #gnunet-namestore -z a -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
74 | #gnunet-namestore -z d -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
75 | #gnunet-namestore -z e -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
76 | #gnunet-namestore -z f -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
77 | #gnunet-namestore -z g -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
78 | |||
79 | gnunet-arm -e -c test_credential_lookup.conf | ||
80 | |||
81 | if [ "$RES_DELS" != "Failed." ] | ||
82 | then | ||
83 | # TODO: replace echo -e bashism | ||
84 | echo -e "${RES_DELS}" | ||
85 | exit 0 | ||
86 | else | ||
87 | echo "FAIL: Failed to verify credential $RES_DELS." | ||
88 | exit 1 | ||
89 | fi | ||
90 | |||
diff --git a/src/credential/test_credential_own.sh b/src/credential/test_credential_own.sh index 4ff1a8e08..2bb5cb070 100755 --- a/src/credential/test_credential_own.sh +++ b/src/credential/test_credential_own.sh | |||
@@ -110,6 +110,7 @@ echo gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subj | |||
110 | RES_DELS=`gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --delegate="$DELS" --backward -c test_credential_lookup.conf` | 110 | RES_DELS=`gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --delegate="$DELS" --backward -c test_credential_lookup.conf` |
111 | 111 | ||
112 | 112 | ||
113 | |||
113 | # Cleanup properly | 114 | # Cleanup properly |
114 | gnunet-namestore -z epub -d -n $DISC_ATTR -t ATTR -c test_credential_lookup.conf | 115 | gnunet-namestore -z epub -d -n $DISC_ATTR -t ATTR -c test_credential_lookup.conf |
115 | gnunet-namestore -z eorg -d -n $PREF_ATTR -t ATTR -c test_credential_lookup.conf | 116 | gnunet-namestore -z eorg -d -n $PREF_ATTR -t ATTR -c test_credential_lookup.conf |