diff options
Diffstat (limited to 'src/credential/test_credential_bi_bw.sh')
-rwxr-xr-x | src/credential/test_credential_bi_bw.sh | 87 |
1 files changed, 0 insertions, 87 deletions
diff --git a/src/credential/test_credential_bi_bw.sh b/src/credential/test_credential_bi_bw.sh deleted file mode 100755 index 618fae95f..000000000 --- a/src/credential/test_credential_bi_bw.sh +++ /dev/null | |||
@@ -1,87 +0,0 @@ | |||
1 | #!/usr/bin/env bash | ||
2 | trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT | ||
3 | |||
4 | LOCATION=$(which gnunet-config) | ||
5 | if [ -z $LOCATION ] | ||
6 | then | ||
7 | LOCATION="gnunet-config" | ||
8 | fi | ||
9 | $LOCATION --version 1> /dev/null | ||
10 | if test $? != 0 | ||
11 | then | ||
12 | echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX" | ||
13 | exit 77 | ||
14 | fi | ||
15 | |||
16 | rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f` | ||
17 | |||
18 | |||
19 | |||
20 | |||
21 | which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 10" | ||
22 | gnunet-arm -s -c test_credential_lookup.conf | ||
23 | |||
24 | gnunet-identity -C a -c test_credential_lookup.conf | ||
25 | gnunet-identity -C b -c test_credential_lookup.conf | ||
26 | gnunet-identity -C c -c test_credential_lookup.conf | ||
27 | gnunet-identity -C d -c test_credential_lookup.conf | ||
28 | gnunet-identity -C e -c test_credential_lookup.conf | ||
29 | gnunet-identity -C f -c test_credential_lookup.conf | ||
30 | gnunet-identity -C g -c test_credential_lookup.conf | ||
31 | AKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep a | awk '{print $3}') | ||
32 | BKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep b | awk '{print $3}') | ||
33 | CKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep c | awk '{print $3}') | ||
34 | DKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep d | awk '{print $3}') | ||
35 | EKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep e | awk '{print $3}') | ||
36 | FKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep f | awk '{print $3}') | ||
37 | GKEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep g | awk '{print $3}') | ||
38 | gnunet-identity -d | ||
39 | |||
40 | # (1) (A.a) <- B.b | ||
41 | # (2) (B.b) <- C.c | ||
42 | # (3) C.c <- (D.D) | ||
43 | # (4) D.d <- (E.e) | ||
44 | # (5) E.e <- (F) | ||
45 | |||
46 | # BIDIRECTIONAL | ||
47 | gnunet-credential --createIssuerSide --ego=a --attribute="a" --subject="$BKEY b" --ttl=5m -c test_credential_lookup.conf | ||
48 | gnunet-namestore -D -z a | ||
49 | gnunet-credential --createIssuerSide --ego=b --attribute="b" --subject="$CKEY c" --ttl=5m -c test_credential_lookup.conf | ||
50 | gnunet-namestore -D -z b | ||
51 | |||
52 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=c --attribute="c" --subject="$DKEY d" --ttl="2019-12-12 10:00:00"` | ||
53 | gnunet-credential --createSubjectSide --ego=d --import="$SIGNED" | ||
54 | gnunet-namestore -D -z d | ||
55 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=d --attribute="d" --subject="$EKEY e" --ttl="2019-12-12 10:00:00"` | ||
56 | gnunet-credential --createSubjectSide --ego=e --import="$SIGNED" | ||
57 | gnunet-namestore -D -z e | ||
58 | SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=e --attribute="e" --subject="$FKEY" --ttl="2019-12-12 10:00:00"` | ||
59 | gnunet-credential --createSubjectSide --ego=f --import="$SIGNED" --private | ||
60 | gnunet-namestore -D -z f | ||
61 | |||
62 | # Starting to resolve | ||
63 | echo "+++ Starting to Resolve +++" | ||
64 | |||
65 | DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$AKEY --attribute="a" --ego=f --forward --backward -c test_credential_lookup.conf | paste -d, -s - -` | ||
66 | echo $DELS | ||
67 | echo gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate=\'$DELS\' --forward --backward -c test_credential_lookup.conf | ||
68 | gnunet-credential --verify --issuer=$AKEY --attribute="a" --subject=$FKEY --delegate="$DELS" --forward --backward -c test_credential_lookup.conf | ||
69 | |||
70 | RES=$? | ||
71 | |||
72 | # Cleanup properly | ||
73 | gnunet-namestore -z a -d -n "a" -t ATTR -c test_credential_lookup.conf | ||
74 | gnunet-namestore -z b -d -n "b" -t ATTR -c test_credential_lookup.conf | ||
75 | gnunet-namestore -z d -d -n "@" -t DEL -c test_credential_lookup.conf | ||
76 | gnunet-namestore -z e -d -n "@" -t DEL -c test_credential_lookup.conf | ||
77 | gnunet-namestore -z f -d -n "@" -t DEL -c test_credential_lookup.conf | ||
78 | |||
79 | gnunet-arm -e -c test_credential_lookup.conf | ||
80 | |||
81 | if [ "$RES" == 0 ] | ||
82 | then | ||
83 | exit 0 | ||
84 | else | ||
85 | echo "FAIL: Failed to verify credential." | ||
86 | exit 1 | ||
87 | fi | ||