diff options
Diffstat (limited to 'src/credential/test_credential_own.sh')
-rwxr-xr-x | src/credential/test_credential_own.sh | 74 |
1 files changed, 60 insertions, 14 deletions
diff --git a/src/credential/test_credential_own.sh b/src/credential/test_credential_own.sh index b53825d1b..23935c75a 100755 --- a/src/credential/test_credential_own.sh +++ b/src/credential/test_credential_own.sh | |||
@@ -21,8 +21,20 @@ rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` | |||
21 | # (4) RegistrarB.student <- Alice | 21 | # (4) RegistrarB.student <- Alice |
22 | 22 | ||
23 | 23 | ||
24 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30" | 24 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" |
25 | gnunet-arm -s -c test_credential_lookup.conf | 25 | gnunet-arm -s -c test_credential_lookup.conf |
26 | |||
27 | gnunet-identity -C a -c test_credential_lookup.conf | ||
28 | gnunet-identity -C d -c test_credential_lookup.conf | ||
29 | gnunet-identity -C e -c test_credential_lookup.conf | ||
30 | gnunet-identity -C f -c test_credential_lookup.conf | ||
31 | gnunet-identity -C g -c test_credential_lookup.conf | ||
32 | AKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep a | awk '{print $3}') | ||
33 | DKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep d | awk '{print $3}') | ||
34 | EKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep e | awk '{print $3}') | ||
35 | FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print $3}') | ||
36 | GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}') | ||
37 | |||
26 | gnunet-identity -C epub -c test_credential_lookup.conf | 38 | gnunet-identity -C epub -c test_credential_lookup.conf |
27 | gnunet-identity -C eorg -c test_credential_lookup.conf | 39 | gnunet-identity -C eorg -c test_credential_lookup.conf |
28 | gnunet-identity -C stateu -c test_credential_lookup.conf | 40 | gnunet-identity -C stateu -c test_credential_lookup.conf |
@@ -42,29 +54,55 @@ STATE_STUD_ATTR="student" | |||
42 | REG_STUD_ATTR="student" | 54 | REG_STUD_ATTR="student" |
43 | END_ATTR="end" | 55 | END_ATTR="end" |
44 | 56 | ||
57 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=a --attribute="a" --subject="$AKEY b.c" --ttl="2019-12-12 10:00:00"` | ||
58 | gnunet-credential --createSubjectSide --ego=a --import "$SIGNED" | ||
59 | gnunet-namestore -D -z a | ||
60 | |||
61 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=a --attribute="b" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` | ||
62 | gnunet-credential --createSubjectSide --ego=d --import "$SIGNED" | ||
63 | gnunet-namestore -D -z d | ||
64 | |||
65 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=d --attribute="d" --subject="$EKEY" --ttl="2019-12-12 10:00:00"` | ||
66 | gnunet-credential --createSubjectSide --ego=e --import "$SIGNED" | ||
67 | gnunet-namestore -D -z e | ||
68 | |||
69 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=e --attribute="c" --subject="$FKEY c" --ttl="2019-12-12 10:00:00"` | ||
70 | gnunet-credential --createSubjectSide --ego=f --import "$SIGNED" | ||
71 | gnunet-namestore -D -z f | ||
72 | |||
73 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=f --attribute="c" --subject="$GKEY" --ttl="2019-12-12 10:00:00"` | ||
74 | gnunet-credential --createSubjectSide --ego=g --import "$SIGNED" | ||
75 | gnunet-namestore -D -z g | ||
76 | |||
77 | |||
78 | |||
45 | TEST_CREDENTIAL="mygnunetcreds" | 79 | TEST_CREDENTIAL="mygnunetcreds" |
46 | # Own issuer side storage: | 80 | # Own issuer side storage: |
47 | gnunet-credential --createIssuerSide --ego=epub --attribute="issside" --subject="$EORG_KEY asd" --ttl=5m | 81 | #gnunet-credential --createIssuerSide --ego=epub --attribute="issside" --subject="$EORG_KEY asd" --ttl=5m |
48 | 82 | ||
49 | gnunet-namestore -D -z epub | 83 | #gnunet-namestore -D -z epub |
50 | 84 | ||
51 | # Own subject side storage: | 85 | # Own subject side storage: |
52 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=epub --attribute="abcd" --subject="$EORG_KEY" --ttl="2019-12-12 10:00:00"` | 86 | #SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=epub --attribute="abcd" --subject="$EORG_KEY" --ttl="2019-12-12 10:00:00"` |
53 | gnunet-credential --createSubjectSide --ego=eorg --import "$SIGNED" | 87 | #gnunet-credential --createSubjectSide --ego=eorg --import "$SIGNED" |
54 | 88 | ||
55 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=epub --attribute="abcd" --subject="$EORG_KEY efghijklmno" --ttl="2019-12-12 10:00:00"` | 89 | #SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=epub --attribute="abcd" --subject="$EORG_KEY efghijklmno" --ttl="2019-12-12 10:00:00"` |
56 | gnunet-credential --createSubjectSide --ego=eorg --import "$SIGNED" | 90 | #gnunet-credential --createSubjectSide --ego=eorg --import "$SIGNED" |
57 | 91 | ||
58 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=epub --attribute="abcd" --subject="$EORG_KEY efghijklmno.pqr" --ttl="2019-12-12 10:00:00"` | 92 | #SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=epub --attribute="abcd" --subject="$EORG_KEY efghijklmno.pqr" --ttl="2019-12-12 10:00:00"` |
59 | gnunet-credential --createSubjectSide --ego=eorg --import "$SIGNED" | 93 | #gnunet-credential --createSubjectSide --ego=eorg --import "$SIGNED" |
60 | 94 | ||
61 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=epub --attribute="abcd.stu" --subject="$EORG_KEY efghijklmno.pqr" --ttl="2019-12-12 10:00:00"` | 95 | #SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=epub --attribute="abcd.stu" --subject="$EORG_KEY efghijklmno.pqr" --ttl="2019-12-12 10:00:00"` |
62 | gnunet-credential --createSubjectSide --ego=eorg --import "$SIGNED" | 96 | #gnunet-credential --createSubjectSide --ego=eorg --import "$SIGNED" |
63 | 97 | ||
64 | gnunet-namestore -D -z eorg | 98 | #SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=stateu --attribute="aaa" --subject="$EPUB_KEY bbbb" --ttl="2019-12-12 10:00:00"` |
99 | #gnunet-credential --createSubjectSide --ego=epub --import "$SIGNED" | ||
100 | |||
101 | #gnunet-namestore -D -z eorg | ||
65 | 102 | ||
66 | # (1) EPub assigns the attribute "discount" to all entities that have been assigned "preferred" by EOrg | 103 | # (1) EPub assigns the attribute "discount" to all entities that have been assigned "preferred" by EOrg |
67 | gnunet-namestore -p -z epub -a -n $DISC_ATTR -t ATTR -V "$EORG_KEY $PREF_ATTR" -e 5m -c test_credential_lookup.conf | 104 | gnunet-namestore -p -z epub -a -n $DISC_ATTR -t ATTR -V "$EORG_KEY $PREF_ATTR" -e 5m -c test_credential_lookup.conf |
105 | gnunet-namestore -p -z epub -a -n "random" -t ATTR -V "$GKEY random" -e 5m -c test_credential_lookup.conf | ||
68 | 106 | ||
69 | # (2) EOrg assigns the attribute "preferred" to all entities that have been assigned "student" by StateU | 107 | # (2) EOrg assigns the attribute "preferred" to all entities that have been assigned "student" by StateU |
70 | gnunet-namestore -p -z eorg -a -n $PREF_ATTR -t ATTR -V "$STATEU_KEY $STATE_STUD_ATTR" -e 5m -c test_credential_lookup.conf | 108 | gnunet-namestore -p -z eorg -a -n $PREF_ATTR -t ATTR -V "$STATEU_KEY $STATE_STUD_ATTR" -e 5m -c test_credential_lookup.conf |
@@ -81,11 +119,13 @@ gnunet-namestore -p -z alice -a -n $TEST_CREDENTIAL -t CRED -V "$CRED" -e 5m -c | |||
81 | # Starting to resolve | 119 | # Starting to resolve |
82 | echo "+++++Starting Collect" | 120 | echo "+++++Starting Collect" |
83 | 121 | ||
84 | CREDS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$EPUB_KEY --attribute=$DISC_ATTR --ego=alice -c test_credential_lookup.conf | paste -d, -s` | 122 | CREDS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$EPUB_KEY --attribute="random" --ego=alice -c test_credential_lookup.conf | paste -d, -s` |
123 | #CREDS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$EPUB_KEY --attribute=$DISC_ATTR --ego=alice -c test_credential_lookup.conf | paste -d, -s` | ||
85 | echo $CREDS | 124 | echo $CREDS |
86 | echo gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --credential=\'$CREDS\' -c test_credential_lookup.conf | 125 | echo gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --credential=\'$CREDS\' -c test_credential_lookup.conf |
87 | 126 | ||
88 | RES_CRED=`gnunet-credential --verify --issuer=$EPUB_KEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --credential="$CREDS" -c test_credential_lookup.conf` | 127 | RES_CRED=`gnunet-credential --verify --issuer=$EPUB_KEY --attribute="random" --subject=$ALICE_KEY --credential="$CREDS" -c test_credential_lookup.conf` |
128 | #RES_CRED=`gnunet-credential --verify --issuer=$GKEY --attribute=$DISC_ATTR --subject=$ALICE_KEY --credential="$CREDS" -c test_credential_lookup.conf` | ||
89 | 129 | ||
90 | 130 | ||
91 | # Cleanup properly | 131 | # Cleanup properly |
@@ -93,6 +133,12 @@ gnunet-namestore -z alice -d -n $TEST_CREDENTIAL -t CRED -e never -c test_creden | |||
93 | gnunet-namestore -z epub -d -n $DISC_ATTR -t ATTR -c test_credential_lookup.conf | 133 | gnunet-namestore -z epub -d -n $DISC_ATTR -t ATTR -c test_credential_lookup.conf |
94 | gnunet-namestore -z eorg -d -n $PREF_ATTR -t ATTR -c test_credential_lookup.conf | 134 | gnunet-namestore -z eorg -d -n $PREF_ATTR -t ATTR -c test_credential_lookup.conf |
95 | gnunet-namestore -z stateu -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | 135 | gnunet-namestore -z stateu -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf |
136 | #gnunet-namestore -z a -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
137 | #gnunet-namestore -z d -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
138 | #gnunet-namestore -z e -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
139 | #gnunet-namestore -z f -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
140 | #gnunet-namestore -z g -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf | ||
141 | |||
96 | gnunet-arm -e -c test_credential_lookup.conf | 142 | gnunet-arm -e -c test_credential_lookup.conf |
97 | 143 | ||
98 | if [ "$RES_CRED" != "Failed." ] | 144 | if [ "$RES_CRED" != "Failed." ] |