summaryrefslogtreecommitdiff
path: root/src/credential/test_credential_bi_and4.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/credential/test_credential_bi_and4.sh')
-rwxr-xr-xsrc/credential/test_credential_bi_and4.sh82
1 files changed, 82 insertions, 0 deletions
diff --git a/src/credential/test_credential_bi_and4.sh b/src/credential/test_credential_bi_and4.sh
new file mode 100755
index 000000000..c4db5c82a
--- /dev/null
+++ b/src/credential/test_credential_bi_and4.sh
@@ -0,0 +1,82 @@
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
31gnunet-identity -C h -c test_credential_lookup.conf
32AKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep a | awk '{print $3}')
33BKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep b | awk '{print $3}')
34CKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep c | awk '{print $3}')
35DKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep d | awk '{print $3}')
36EKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep e | awk '{print $3}')
37FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print $3}')
38GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}')
39HKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep h | awk '{print $3}')
40
41# (1) (A.a) <- B.b
42# (2) (B.b) <- C.c AND G.g
43# (3) C.c <- (F) priv
44# (4) G.g <- (F) priv
45
46# BIDIRECTIONAL
47gnunet-credential --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_credential_lookup.conf
48gnunet-namestore -D -z a
49gnunet-credential --createIssuerSide --ego=b --attribute="b" --subject="$CKEY c, $GKEY g" --ttl=5m -c test_credential_lookup.conf
50gnunet-namestore -D -z b
51
52SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=g --attribute="g" --subject="$FKEY" --ttl="2019-12-12 10:00:00"`
53gnunet-credential --createSubjectSide --ego=f --import "$SIGNED" --private
54SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=c --attribute="c" --subject="$FKEY" --ttl="2019-12-12 10:00:00"`
55gnunet-credential --createSubjectSide --ego=f --import "$SIGNED" --private
56gnunet-namestore -D -z f
57
58# Starting to resolve
59echo "+++ Starting to Resolve +++"
60
61DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --backward -c test_credential_lookup.conf | paste -d, -s`
62echo $DELS
63echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --backward -c test_credential_lookup.conf
64gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --backward -c test_credential_lookup.conf
65
66RES=$?
67
68# Cleanup properly
69gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf
70gnunet-namestore -z b -d -n "b" -t ATTR -c test_credential_lookup.conf
71gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf
72
73gnunet-arm -e -c test_credential_lookup.conf
74
75if [ "$RES" == 0 ]
76then
77 exit 0
78else
79 echo "FAIL: Failed to verify credential."
80 exit 1
81fi
82