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) Authority.test -> Intermediate.org.user
19 # (2) Intermediate.org -> Issuer
20 # (3) Issuer.user -> Subject
23 which timeout &> /dev/null && DO_TIMEOUT="timeout 30"
24 gnunet-arm -s -c test_credential_lookup.conf
25 gnunet-identity -C testissuer -c test_credential_lookup.conf
26 gnunet-identity -C testsubject -c test_credential_lookup.conf
27 gnunet-identity -C testintermediate -c test_credential_lookup.conf
28 gnunet-identity -C testauthority -c test_credential_lookup.conf
31 INTERMEDIATE_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testintermediate | awk '{print $3}')
32 SUBJECT_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testsubject | awk '{print $3}')
33 ISSUER_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testissuer | awk '{print $3}')
34 CRED=`$DO_TIMEOUT gnunet-credential --issue --ego=testissuer --subject=$SUBJECT_KEY --attribute=$TEST_ATTR -c test_credential_lookup.conf`
37 gnunet-namestore -p -z testsubject -a -n $TEST_CREDENTIAL -t CRED -V "$CRED" -e 5m -c test_credential_lookup.conf
39 INTERMEDIATE_ATTR="org"
40 gnunet-namestore -p -z testintermediate -a -n $INTERMEDIATE_ATTR -t ATTR -V "$ISSUER_KEY" -e 5m -c test_credential_lookup.conf
43 gnunet-namestore -p -z testauthority -a -n $AUTHORITY_ATTR -t ATTR -V "$INTERMEDIATE_KEY $INTERMEDIATE_ATTR.$TEST_ATTR" -e 5m -c test_credential_lookup.conf
45 #TODO2 Add -z swich like in gnunet-gns
46 #RES_CRED=`$DO_TIMEOUT gnunet-credential --verify --issuer=$ISSUER_KEY --attribute="$TEST_ATTR" --subject=$SUBJECT_KEY --credential=$TEST_CREDENTIAL -c test_credential_lookup.conf`
47 valgrind gnunet-credential --verify --issuer=$AUTHORITY_KEY --attribute=$AUTHORITY_ATTR --subject=$SUBJECT_KEY --credential=$TEST_CREDENTIAL -c test_credential_lookup.conf
49 #TODO cleanup properly
50 gnunet-namestore -z testsubject -d -n $TEST_CREDENTIAL -t CRED -e never -c test_credential_lookup.conf
51 gnunet-arm -e -c test_credential_lookup.conf
56 if [ "$RES_CRED" == "Ok!" ]
60 echo "FAIL: Failed to verify credential $RES_IP."