aboutsummaryrefslogtreecommitdiff
path: root/src/service/identity/test_identity_messages.sh
diff options
context:
space:
mode:
Diffstat (limited to 'src/service/identity/test_identity_messages.sh')
-rwxr-xr-xsrc/service/identity/test_identity_messages.sh50
1 files changed, 50 insertions, 0 deletions
diff --git a/src/service/identity/test_identity_messages.sh b/src/service/identity/test_identity_messages.sh
new file mode 100755
index 000000000..edb4d5805
--- /dev/null
+++ b/src/service/identity/test_identity_messages.sh
@@ -0,0 +1,50 @@
1#!/bin/bash
2trap "gnunet-arm -e -c test_identity.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_identity.conf -s PATHS -o GNUNET_HOME -f`
17
18which timeout >/dev/null 2>&1 && DO_TIMEOUT="timeout 30"
19
20TEST_MSG="This is a test message. 123"
21gnunet-arm -s -c test_identity.conf
22gnunet-identity -C recipientego -c test_identity.conf
23gnunet-identity -C recipientegoed -X -c test_identity.conf
24RECIPIENT_KEY=`gnunet-identity -d -e recipientego -q -c test_identity.conf`
25MSG_ENC=`gnunet-identity -W "$TEST_MSG" -k $RECIPIENT_KEY -c test_identity.conf`
26if [ $? == 0 ]
27then
28 MSG_DEC=`gnunet-identity -R "$MSG_ENC" -e recipientego -c test_identity.conf`
29fi
30RECIPIENT_KEY_ED=`gnunet-identity -d -e recipientegoed -q -c test_identity.conf`
31MSG_ENC_ED=`gnunet-identity -W "$TEST_MSG" -k $RECIPIENT_KEY_ED -c test_identity.conf`
32if [ $? == 0 ]
33then
34 MSG_DEC_ED=`gnunet-identity -R "$MSG_ENC_ED" -e recipientegoed -c test_identity.conf`
35fi
36gnunet-identity -D recipientego -c test_identity.conf
37gnunet-identity -D recipientegoed -c test_identity.conf
38gnunet-arm -e -c test_identity.conf
39if [ "$TEST_MSG" != "$MSG_DEC" ]
40then
41 diff <(echo "$TEST_MSG" ) <(echo "$MSG_DEC")
42 echo "Failed - \"$TEST_MSG\" != \"$MSG_DEC\""
43 exit 1
44fi
45if [ "$TEST_MSG" != "$MSG_DEC_ED" ]
46then
47 diff <(echo "$TEST_MSG" ) <(echo "$MSG_DEC_ED")
48 echo "Failed - \"$TEST_MSG\" != \"$MSG_DEC_ED\""
49 exit 1
50fi