test_reclaim_revoke.sh 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465
  1. #!/bin/bash
  2. trap "gnunet-arm -e -c test_reclaim.conf" SIGINT
  3. LOCATION=$(which gnunet-config)
  4. if [ -z $LOCATION ]
  5. then
  6. LOCATION="gnunet-config"
  7. fi
  8. $LOCATION --version 1> /dev/null
  9. if test $? != 0
  10. then
  11. echo "GNUnet command line tools cannot be found, check environmental variables PATH and GNUNET_PREFIX"
  12. exit 77
  13. fi
  14. rm -rf `gnunet-config -c test_reclaim.conf -s PATHS -o GNUNET_HOME -f`
  15. # (1) PKEY1.user -> PKEY2.resu.user
  16. # (2) PKEY2.resu -> PKEY3
  17. # (3) PKEY3.user -> PKEY4
  18. which timeout >/dev/null 2&>1 && DO_TIMEOUT="timeout 30"
  19. TEST_ATTR="test"
  20. gnunet-arm -s -c test_reclaim.conf >/dev/null 2&>1
  21. gnunet-identity -C alice -c test_reclaim.conf
  22. gnunet-identity -C bob -c test_reclaim.conf
  23. gnunet-identity -C eve -c test_reclaim.conf
  24. ALICE_KEY=$(gnunet-identity -d -e alice -q -c test_reclaim.conf)
  25. BOB_KEY=$(gnunet-identity -d -e bob -q -c test_reclaim.conf)
  26. EVE_KEY=$(gnunet-identity -d -e eve -q -c test_reclaim.conf)
  27. gnunet-reclaim -e alice -E 15s -a email -V john@doe.gnu -c test_reclaim.conf
  28. gnunet-reclaim -e alice -E 15s -a name -V John -c test_reclaim.conf
  29. TICKET_BOB=$(gnunet-reclaim -e alice -i "email,name" -r $BOB_KEY -c test_reclaim.conf | awk '{print $1}')
  30. #gnunet-reclaim -e bob -C $TICKET_BOB -c test_reclaim.conf
  31. TICKET_EVE=$(gnunet-reclaim -e alice -i "email" -r $EVE_KEY -c test_reclaim.conf | awk '{print $1}')
  32. gnunet-namestore -z alice -D
  33. echo "Revoking $TICKET"
  34. gnunet-reclaim -e alice -R $TICKET_EVE -c test_reclaim.conf
  35. gnunet-namestore -z alice -D
  36. sleep 16
  37. echo "Consuming $TICKET"
  38. gnunet-reclaim -e eve -C $TICKET_EVE -c test_reclaim.conf
  39. if test $? = 0
  40. then
  41. echo "Eve can still resolve attributes..."
  42. gnunet-arm -e -c test_reclaim.conf
  43. exit 1
  44. fi
  45. gnunet-arm -e -c test_reclaim.conf
  46. gnunet-arm -s -c test_reclaim.conf >/dev/null 2&>1
  47. gnunet-reclaim -e bob -C $TICKET_BOB -c test_reclaim.conf
  48. #gnunet-reclaim -e bob -C $TICKET_BOB -c test_reclaim.conf >/dev/null 2&>1
  49. if test $? != 0
  50. then
  51. echo "Bob cannot resolve attributes..."
  52. gnunet-arm -e -c test_reclaim.conf
  53. exit 1
  54. fi
  55. gnunet-arm -e -c test_reclaim.conf