summaryrefslogtreecommitdiff
path: root/src/credential/test_credential_bi.sh
diff options
context:
space:
mode:
authorAndreas Ebner <pansy007@googlemail.com>2019-08-11 17:04:00 +0200
committerSchanzenbach, Martin <mschanzenbach@posteo.de>2019-10-07 12:17:28 +0200
commit7b749c91759eb75eda5cac1e02954cc82ef27db3 (patch)
tree7e3e1cde1638073d764be9399f52b04937cdbe14 /src/credential/test_credential_bi.sh
parent33525da20575ba0149d1c6bcaac74e52d4e0ddd7 (diff)
downloadgnunet-7b749c91759eb75eda5cac1e02954cc82ef27db3.tar.gz
gnunet-7b749c91759eb75eda5cac1e02954cc82ef27db3.zip
Unfinished implementation of bidirectional search:
- queue to add all currently found nodes - backward_resolution implementation of what to do when you find a matching one - new test for bidirecitonal search - still a lot to do / still has a lot of prints and comments that need to be removed
Diffstat (limited to 'src/credential/test_credential_bi.sh')
-rwxr-xr-xsrc/credential/test_credential_bi.sh90
1 files changed, 90 insertions, 0 deletions
diff --git a/src/credential/test_credential_bi.sh b/src/credential/test_credential_bi.sh
new file mode 100755
index 000000000..2b8cfc452
--- /dev/null
+++ b/src/credential/test_credential_bi.sh
@@ -0,0 +1,90 @@
1#!/usr/bin/env bash
2trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT
3
4LOCATION=$(which gnunet-config)
5if [ -z $LOCATION ]
6then
7 LOCATION="gnunet-config"
8fi
9$LOCATION --version 1> /dev/null
10if test $? != 0
11then
12 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
13 exit 77
14fi
15
16rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f`
17
18
19
20
21which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10"
22gnunet-arm -s -c test_credential_lookup.conf
23
24gnunet-identity -C a -c test_credential_lookup.conf
25gnunet-identity -C b -c test_credential_lookup.conf
26gnunet-identity -C c -c test_credential_lookup.conf
27gnunet-identity -C d -c test_credential_lookup.conf
28gnunet-identity -C e -c test_credential_lookup.conf
29gnunet-identity -C f -c test_credential_lookup.conf
30gnunet-identity -C g -c test_credential_lookup.conf
31AKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep a | awk '{print $3}')
32BKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep b | awk '{print $3}')
33CKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep c | awk '{print $3}')
34DKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep d | awk '{print $3}')
35EKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep e | awk '{print $3}')
36FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print $3}')
37GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}')
38
39# (1) (A.a) <- B.b
40# (2) (B.b) <- C.c
41# (3) C.c <- (D.D)
42# (4) D.d <- (E.e)
43# (5) E.e <- (F)
44
45# BIDIRECTIONAL
46gnunet-credential --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_credential_lookup.conf
47gnunet-namestore -D -z a
48gnunet-credential --createIssuerSide --ego=b --attribute="b" --subject="$CKEY c" --ttl=5m -c test_credential_lookup.conf
49gnunet-namestore -D -z b
50
51SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=c --attribute="c" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"`
52gnunet-credential --createSubjectSide --ego=d --import "$SIGNED"
53gnunet-namestore -D -z d
54SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=d --attribute="d" --subject="$EKEY e" --ttl="2019-12-12 10:00:00"`
55gnunet-credential --createSubjectSide --ego=e --import "$SIGNED"
56gnunet-namestore -D -z e
57SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=e --attribute="e" --subject="$FKEY" --ttl="2019-12-12 10:00:00"`
58gnunet-credential --createSubjectSide --ego=f --import "$SIGNED" --private
59gnunet-namestore -D -z f
60
61# Starting to resolve
62echo "+++ Starting to Resolve +++"
63
64DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s`
65echo $DELS
66echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf
67RES_DELS=`gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf`
68
69# Cleanup properly
70gnunet-namestore -z epub -d -n $DISC_ATTR -t ATTR -c test_credential_lookup.conf
71gnunet-namestore -z eorg -d -n $PREF_ATTR -t ATTR -c test_credential_lookup.conf
72gnunet-namestore -z stateu -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf
73#gnunet-namestore -z a -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf
74#gnunet-namestore -z d -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf
75#gnunet-namestore -z e -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf
76#gnunet-namestore -z f -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf
77#gnunet-namestore -z g -d -n $STATE_STUD_ATTR -t ATTR -c test_credential_lookup.conf
78
79gnunet-arm -e -c test_credential_lookup.conf
80
81if [ "$RES_DELS" != "Failed." ]
82then
83 # TODO: replace echo -e bashism
84 echo -e "${RES_DELS}"
85 exit 0
86else
87 echo "FAIL: Failed to verify credential $RES_DELS."
88 exit 1
89fi
90