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/credential/test_credential_verify.sh | |
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/credential/test_credential_verify.sh')
-rwxr-xr-x | src/credential/test_credential_verify.sh | 41 |
1 files changed, 22 insertions, 19 deletions
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 |