aboutsummaryrefslogtreecommitdiff
path: root/src/credential/test_credential_verify.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/credential/test_credential_verify.sh')
-rwxr-xr-xsrc/credential/test_credential_verify.sh59
1 files changed, 38 insertions, 21 deletions
diff --git a/src/credential/test_credential_verify.sh b/src/credential/test_credential_verify.sh
index ab3c78f41..3b76d20e5 100755
--- a/src/credential/test_credential_verify.sh
+++ b/src/credential/test_credential_verify.sh
@@ -15,39 +15,56 @@ 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) Authority.test -> Intermediate.org.user 18# (1) Service.user -> GNU.project.member
19# (2) Intermediate.org -> Issuer 19# (2) GNU.project -> GNUnet
20# (3) Issuer.user -> Subject 20# (3) GNUnet.member -> GNUnet.developer
21# (4) GNUnet.member -> GNUnet.user
22# (5) GNUnet.developer -> Alice
21 23
22 24
23which timeout &> /dev/null && DO_TIMEOUT="timeout 30" 25which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
24gnunet-arm -s -c test_credential_lookup.conf 26gnunet-arm -s -c test_credential_lookup.conf
25gnunet-identity -C testissuer -c test_credential_lookup.conf 27gnunet-identity -C service -c test_credential_lookup.conf
26gnunet-identity -C testsubject -c test_credential_lookup.conf 28gnunet-identity -C alice -c test_credential_lookup.conf
27gnunet-identity -C testintermediate -c test_credential_lookup.conf 29gnunet-identity -C gnu -c test_credential_lookup.conf
28gnunet-identity -C testauthority -c test_credential_lookup.conf 30gnunet-identity -C gnunet -c test_credential_lookup.conf
29 31
30TEST_ATTR="user" 32GNU_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep gnu | grep -v gnunet | awk '{print $3}')
31INTERMEDIATE_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testintermediate | awk '{print $3}') 33ALICE_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep alice | awk '{print $3}')
32SUBJECT_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testsubject | awk '{print $3}') 34GNUNET_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep gnunet | awk '{print $3}')
33ISSUER_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testissuer | awk '{print $3}') 35SERVICE_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep service | awk '{print $3}')
34AUTHORITY_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testauthority | awk '{print $3}')
35CRED=`$DO_TIMEOUT gnunet-credential --issue --ego=testissuer --subject=$SUBJECT_KEY --attribute=$TEST_ATTR --ttl=5m -c test_credential_lookup.conf`
36 36
37TEST_CREDENTIAL="t1" 37USER_ATTR="user"
38gnunet-namestore -p -z testsubject -a -n $TEST_CREDENTIAL -t CRED -V "$CRED" -e 5m -c test_credential_lookup.conf 38GNU_PROJECT_ATTR="project"
39MEMBER_ATTR="member"
40DEVELOPER_ATTR="developer"
41DEV_ATTR="developer"
42TEST_CREDENTIAL="mygnunetcreds"
39 43
40INTERMEDIATE_ATTR="org" 44# (1) A service assigns the attribute "user" to all entities that have been assigned "member" by entities that werde assigned "project" from GNU
41gnunet-namestore -p -z testintermediate -a -n $INTERMEDIATE_ATTR -t ATTR -V "$ISSUER_KEY" -e 5m -c test_credential_lookup.conf 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
42 46
43AUTHORITY_ATTR="test" 47# (2) GNU recognized GNUnet as a GNU project and delegates the "project" attribute
44gnunet-namestore -p -z testauthority -a -n $AUTHORITY_ATTR -t ATTR -V "$INTERMEDIATE_KEY $INTERMEDIATE_ATTR.$TEST_ATTR" -e 5m -c test_credential_lookup.conf 48gnunet-namestore -p -z gnu -a -n $GNU_PROJECT_ATTR -t ATTR -V "$GNUNET_KEY" -e 5m -c test_credential_lookup.conf
49
50# (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
52gnunet-namestore -p -z gnunet -a -n $MEMBER_ATTR -t ATTR -V "$GNUNET_KEY $USER_ATTR" -e 5m -c test_credential_lookup.conf
53
54# (5) GNUnet issues Alice the credential "developer"
55CRED=`$DO_TIMEOUT gnunet-credential --issue --ego=gnunet --subject=$ALICE_KEY --attribute=$DEV_ATTR --ttl=5m -c test_credential_lookup.conf`
56
57# Alice stores the credential under "mygnunetcreds"
58gnunet-namestore -p -z alice -a -n $TEST_CREDENTIAL -t CRED -V "$CRED" -e 5m -c test_credential_lookup.conf
45 59
46#TODO2 Add -z swich like in gnunet-gns 60#TODO2 Add -z swich like in gnunet-gns
47RES_CRED=`gnunet-credential --verify --issuer=$AUTHORITY_KEY --attribute=$AUTHORITY_ATTR --subject=$SUBJECT_KEY --credential=$TEST_CREDENTIAL -c test_credential_lookup.conf` 61RES_CRED=`gnunet-credential --verify --issuer=$SERVICE_KEY --attribute=$USER_ATTR --subject=$ALICE_KEY --credential=$TEST_CREDENTIAL -c test_credential_lookup.conf`
48 62
49#TODO cleanup properly 63#TODO cleanup properly
50gnunet-namestore -z testsubject -d -n $TEST_CREDENTIAL -t CRED -e never -c test_credential_lookup.conf 64gnunet-namestore -z alice -d -n $TEST_CREDENTIAL -t CRED -e never -c test_credential_lookup.conf
65gnunet-namestore -z gnu -d -n $GNU_PROJECT_ATTR -t ATTR -c test_credential_lookup.conf
66gnunet-namestore -z gnunet -d -n $MEMBER_ATTR -t ATTR -c test_credential_lookup.conf
67gnunet-namestore -z service -d -n $USER_ATTR -t ATTR -c test_credential_lookup.conf
51gnunet-arm -e -c test_credential_lookup.conf 68gnunet-arm -e -c test_credential_lookup.conf
52 69
53if [ "$RES_CRED" == "Successful." ] 70if [ "$RES_CRED" == "Successful." ]