2 trap "gnunet-arm -e -c test_credential_lookup.conf" SIGINT
4 LOCATION=$(which gnunet-config)
7 LOCATION="gnunet-config"
9 $LOCATION --version 1> /dev/null
12 echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
16 rm -rf `gnunet-config -c test_credential_lookup.conf -s PATHS -o GNUNET_HOME -f`
18 # (1) PKEY1.user -> PKEY2.resu.user
19 # (2) PKEY2.resu -> PKEY3
20 # (3) PKEY3.user -> PKEY4
23 which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
27 TEST_DELEGATION_SUBJECT="PKEY2"
28 TEST_DELEGATION_ATTR="$TEST_SUB_ATTR.$TEST_ATTR"
29 TEST_SUBDELEGATION_SUBJECT="PKEY3"
32 gnunet-arm -s -c test_credential_lookup.conf
33 gnunet-identity -C testone -c test_credential_lookup.conf
34 gnunet-identity -C testtwo -c test_credential_lookup.conf
35 gnunet-identity -C testthree -c test_credential_lookup.conf
36 gnunet-identity -C testfour -c test_credential_lookup.conf
38 #TODO1 Get credential and store it with subject (3)
39 CRED=`$DO_TIMEOUT gnunet-credential --issue --issuer=$TEST_SUBDELEGATION_SUBJECT --attribute=$TEST_SUB_ATTR --expiration 1m -c test_credential_lookup.conf`
40 gnunet-namestore -p -z testfour -a -n $TEST_CREDENTIAL -t CRED -V $CRED -e 5m -c test_credential_lookup.conf
43 gnunet-namestore -p -z testone -a -n $TEST_ATTR -t ATTR -V "$TEST_DELEGATION_SUBJECT $TEST_DELEGATION_ATTR"
46 gnunet-namestore -p -z testtwo -a -n $TEST_SUB_ATTR -t ATTR -V "$TEST_SUBDELEGATION_SUBJECT"
49 #TODO2 Add -z swich like in gnunet-gns
50 RES_IP=`$DO_TIMEOUT gnunet-credential --verify --issuer=$TEST_ISSUER --attribute="$TEST_DELEGATION_ATTR" --subject=$TEST_SUBJECT --credential=$TEST_CREDENTIAL -c test_credential_lookup.conf`
52 #TODO cleanup properly
53 gnunet-namestore -z testsubject -d -n newcred -t CRED -e never -c test_credential_lookup.conf
54 gnunet-identity -D testsubject -c test_credential_lookup.conf
55 gnunet-arm -e -c test_credential_lookup.conf
60 #if [ "$RES_IP" == "$TEST_CRED" ]
64 # echo "FAIL: Failed to resolve to proper IP, got $RES_IP."