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) Issuer.user -> Subject
21 which timeout > /dev/null 2>&1 && DO_TIMEOUT="timeout 30"
22 gnunet-arm -s -c test_credential_lookup.conf
23 gnunet-identity -C testissuer -c test_credential_lookup.conf
24 gnunet-identity -C testsubject -c test_credential_lookup.conf
27 SUBJECT_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testsubject | awk '{print $3}')
28 ISSUER_KEY=$(gnunet-identity -d -c test_credential_lookup.conf | grep testissuer | awk '{print $3}')
31 SIGNED=`$DO_TIMEOUT gnunet-credential --signSubjectSide --ego=testissuer --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --ttl="2019-12-12 10:00:00" -c test_credential_lookup.conf`
32 gnunet-credential --createSubjectSide --ego=testsubject --import "$SIGNED" --private
33 gnunet-namestore -D -z testsubject
36 echo "+++ Starting to Resolve +++"
38 DELS=`$DO_TIMEOUT gnunet-credential --collect --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --ego=testsubject -c test_credential_lookup.conf | paste -d, -s`
40 gnunet-credential --verify --issuer=$ISSUER_KEY --attribute=$TEST_ATTR --subject=$SUBJECT_KEY --delegate="$DELS" -c test_credential_lookup.conf
45 gnunet-namestore -z testsubject -d -n "@" -t DEL -c test_credential_lookup.conf
46 gnunet-arm -e -c test_credential_lookup.conf
52 echo "FAIL: Failed to verify credential."