#!/bin/sh
# acme_rockets_intersection

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

acme=`creddy --keyid --cert $keyloc/Acme_ID.pem`
batman=`creddy --keyid --cert $keyloc/Batman_ID.pem`
coyote=`creddy --keyid --cert $keyloc/Coyote_ID.pem`

buy_rockets="$acme.buy_rockets"
coyote_prin="$coyote"
batman_prin="$batman"
bad_buy_rockets="$acme.bad_buy_rockets"
bad_buy_rockets2="99$acme.buy_rockets"

echo "  "
echo "===good============ Acme.buy_rockets <- Coyote"
$eloc/abac_prover  --keystore $keyloc \
              --role "$buy_rockets" --principal "$coyote_prin"

echo "  "
echo "===bad============ Acme.bad_buy_rockets <- Coyote"
$eloc/abac_prover  --keystore $keyloc \
              --role "$bad_buy_rockets" --principal "$coyote_prin"

echo "  "
echo "===bad============ 99Acme.buy_rockets <- Coyote"
$eloc/abac_prover  --keystore $keyloc \
              --role "$bad_buy_rockets2" --principal "$coyote_prin"

echo "  "
echo "===bad=============== Acme.buy_rockets <- Batman"
$eloc/abac_prover  --keystore $keyloc \
              --role "$buy_rockets" --principal "$batman_prin"


