summaryrefslogtreecommitdiff
path: root/src/credential/test_credential_verify_and.sh
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/credential/test_credential_verify_and.sh
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/credential/test_credential_verify_and.sh')
-rwxr-xr-xsrc/credential/test_credential_verify_and.sh50
1 files changed, 27 insertions, 23 deletions
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