aboutsummaryrefslogtreecommitdiff
path: root/src/abd/test_abd_bi_and3.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/abd/test_abd_bi_and3.sh')
-rwxr-xr-xsrc/abd/test_abd_bi_and3.sh96
1 files changed, 96 insertions, 0 deletions
diff --git a/src/abd/test_abd_bi_and3.sh b/src/abd/test_abd_bi_and3.sh
new file mode 100755
index 000000000..cde2a020b
--- /dev/null
+++ b/src/abd/test_abd_bi_and3.sh
@@ -0,0 +1,96 @@
1#!/usr/bin/env bash
2trap "gnunet-arm -e -c test_abd_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_abd_lookup.conf -s PATHS -o GNUNET_HOME -f`
17
18
19
20which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10"
21gnunet-arm -s -c test_abd_lookup.conf
22
23gnunet-identity -C a -c test_abd_lookup.conf
24gnunet-identity -C b -c test_abd_lookup.conf
25gnunet-identity -C c -c test_abd_lookup.conf
26gnunet-identity -C d -c test_abd_lookup.conf
27gnunet-identity -C e -c test_abd_lookup.conf
28gnunet-identity -C f -c test_abd_lookup.conf
29gnunet-identity -C g -c test_abd_lookup.conf
30gnunet-identity -C h -c test_abd_lookup.conf
31AKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep a | awk '{print $3}')
32BKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep b | awk '{print $3}')
33CKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep c | awk '{print $3}')
34DKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep d | awk '{print $3}')
35EKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep e | awk '{print $3}')
36FKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep f | awk '{print $3}')
37GKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep g | awk '{print $3}')
38HKEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep h | awk '{print $3}')
39gnunet-identity -d
40
41# (1) (A.a) <- B.b
42# (2) (B.b) <- C.c AND G.g
43# (3) C.c <- (D.d)
44# (4) D.d <- (E.e)
45# (5) E.e <- (F) priv
46# (6) G.g <- (H.h)
47# (7) H.h <- (F) priv
48
49# BIDIRECTIONAL
50gnunet-abd --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_abd_lookup.conf
51gnunet-namestore -D -z a
52gnunet-abd --createIssuerSide --ego=b --attribute="b" --subject="$CKEY c, $GKEY g" --ttl=5m -c test_abd_lookup.conf
53gnunet-namestore -D -z b
54
55SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=c --attribute="c" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"`
56gnunet-abd --createSubjectSide --ego=d --import="$SIGNED"
57gnunet-namestore -D -z d
58SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=d --attribute="d" --subject="$EKEY e" --ttl="2019-12-12 10:00:00"`
59gnunet-abd --createSubjectSide --ego=e --import="$SIGNED"
60gnunet-namestore -D -z e
61SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=g --attribute="g" --subject="$HKEY h" --ttl="2019-12-12 10:00:00"`
62gnunet-abd --createSubjectSide --ego=h --import="$SIGNED"
63gnunet-namestore -D -z h
64SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=e --attribute="e" --subject="$FKEY" --ttl="2019-12-12 10:00:00"`
65gnunet-abd --createSubjectSide --ego=f --import="$SIGNED" --private
66SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=h --attribute="h" --subject="$FKEY" --ttl="2019-12-12 10:00:00"`
67gnunet-abd --createSubjectSide --ego=f --import="$SIGNED" --private
68gnunet-namestore -D -z f
69
70# Starting to resolve
71echo "+++ Starting to Resolve +++"
72
73DELS=`$DO_TIMEOUT gnunet-abd --collect --issuer=$AKEY --attribute="a" --ego=f -c test_abd_lookup.conf | paste -d, -s - -`
74echo $DELS
75echo gnunet-abd --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' -c test_abd_lookup.conf
76gnunet-abd --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" -c test_abd_lookup.conf
77
78RES=$?
79
80# Cleanup properly
81gnunet-namestore -z a -d -n "a" -t ATTR -c test_abd_lookup.conf
82gnunet-namestore -z b -d -n "b" -t ATTR -c test_abd_lookup.conf
83gnunet-namestore -z d -d -n "@" -t DEL -c test_abd_lookup.conf
84gnunet-namestore -z e -d -n "@" -t DEL -c test_abd_lookup.conf
85gnunet-namestore -z f -d -n "@" -t DEL -c test_abd_lookup.conf
86gnunet-namestore -z h -d -n "@" -t DEL -c test_abd_lookup.conf
87
88gnunet-arm -e -c test_abd_lookup.conf
89
90if [ "$RES" == 0 ]
91then
92 exit 0
93else
94 echo "FAIL: Failed to verify credential."
95 exit 1
96fi