summaryrefslogtreecommitdiff
path: root/src/credential/test_credential_verify.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.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.sh')
-rwxr-xr-xsrc/credential/test_credential_verify.sh41
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"
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