summaryrefslogtreecommitdiff
path: root/src/abd/test_abd_verify_simple.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/abd/test_abd_verify_simple.sh')
-rwxr-xr-xsrc/abd/test_abd_verify_simple.sh56
1 files changed, 56 insertions, 0 deletions
diff --git a/src/abd/test_abd_verify_simple.sh b/src/abd/test_abd_verify_simple.sh
new file mode 100755
index 000000000..e917f8793
--- /dev/null
+++ b/src/abd/test_abd_verify_simple.sh
@@ -0,0 +1,56 @@
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# (1) Issuer.user -> Subject
19
20
21which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
22gnunet-arm -s -c test_abd_lookup.conf
23gnunet-identity -C testissuer -c test_abd_lookup.conf
24gnunet-identity -C testsubject -c test_abd_lookup.conf
25
26TEST_ATTR="user"
27SUBJECT_KEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep testsubject | awk '{print $3}')
28ISSUER_KEY=$(gnunet-identity -d -c test_abd_lookup.conf | grep testissuer | awk '{print $3}')
29
30gnunet-identity -d
31
32# Create delegate (1)
33SIGNED=`$DO_TIMEOUT gnunet-abd --signSubjectSide --ego=testissuer --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --ttl="2019-12-12 10:00:00" -c test_abd_lookup.conf`
34gnunet-abd --createSubjectSide --ego=testsubject --import="$SIGNED" --private
35gnunet-namestore -D -z testsubject
36
37# Starting to resolve
38echo "+++ Starting to Resolve +++"
39
40DELS=`$DO_TIMEOUT gnunet-abd --collect --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --ego=testsubject -c test_abd_lookup.conf | paste -d, -s - -`
41echo $DELS
42gnunet-abd --verify --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --delegate="$DELS" -c test_abd_lookup.conf
43
44RES=$?
45
46# Cleanup properly
47gnunet-namestore -z testsubject -d -n "@" -t DEL -c test_abd_lookup.conf
48gnunet-arm -e -c test_abd_lookup.conf
49
50if [ "$RES" == 0 ]
51then
52 exit 0
53else
54 echo "FAIL: Failed to verify credential."
55 exit 1
56fi \ No newline at end of file