#!/bin/sh

pwd=`pwd`
eloc=`which abac_prover | sed 's/\/abac_prover//'`
if [ "$eloc" = "" ]; then
  echo "ERROR: abac_prover is not in the search path!!!"
  exit 1
fi

keyloc=$pwd

ice=`creddy --keyid --cert $keyloc/IceCream_ID.pem`
chocolate_prin=`creddy --keyid --cert $keyloc/Chocolate_ID.pem`

delicious="$ice.delicious"

echo "  "
echo "===good============ IceCream.delicious <- Chocolate"
$eloc/abac_prover  --keystore $keyloc \
      --role "$delicious" --principal "$chocolate_prin"


rm -rf IceCream*.pem
echo "  "
echo "===good(no issuer)============ IceCream.delicious <- Chocolate"
$eloc/abac_prover  --keystore $keyloc \
      --role "$delicious" --principal "$chocolate_prin"

rm -rf Chocolate*.pem
echo "  "
echo "===good(no issuer & no principal)============ IceCream.delicious <- Chocolate"
$eloc/abac_prover  --keystore $keyloc \
      --role "$delicious" --principal "$chocolate_prin"


