#!/bin/sh

## trying out different data param types

#rm -rf *.der *.pem

#creddy --generate --cn Alice
#creddy --generate --cn Hatter
#creddy --generate --cn MarchHare
#creddy --generate --cn Dormouse
#creddy --generate --cn Tea
#creddy --generate --cn Party 

alice_keyid=`creddy --keyid --cert Alice_ID.pem`
party_keyid=`creddy --keyid --cert Party_ID.pem`
tea_keyid=`creddy --keyid --cert Tea_ID.pem`
hatter_keyid=`creddy --keyid --cert Hatter_ID.pem`
marchhare_keyid=`creddy --keyid --cert MarchHare_ID.pem`
dormouse_keyid=`creddy --keyid --cert Dormouse_ID.pem`

friendof_alice="friendOf([keyid:$alice_keyid])"
friendof_marchhare="friendOf([keyid:$marchhare_keyid])"
guestof_marchhare="guestOf([keyid:$marchhare_keyid])"

#okay, about_party="about([time:20201101T],[time:20110614T])"
#okay, about_party="about([keyid:$tea_keyid],[time:20101010T])"
#bad, about_party="about([keyid:$tea_keyid],[keyid:$alice_keyid])"
#bad, about_party="about([keyid:$tea_keyid],[time:20100203T],[keyid:$alice_keyid])"
#about_party="about([keyid:$tea_keyid],[keyid:$alice_keyid],[time:20101010T])"
about_party="about([keyid:$tea_keyid],[time:20101010T],[boolean:true],[integer:4],[float:-200.0],[float:8],[time:20120205T182930],[string:'guest list'],[urn:'file://usr/local/party/~teaparty'])"

#[keyid:Party].role:about([keyid:tea],[time:201010],[string:'guest list'],[boolean:true],[integer:4]) <- [keyid:Party].role:guestOf([keyid:MarchHare])
echo "creddy --attribute --issuer Party_ID.pem --key Party_private.pem --role \"$about_party\" --subject-cert Party_ID.pem --subject-role  \"$guestof_marchhare\" --out party_about_party__guestof_marchhare_attr.der"
/home/mei/Deter/abac/creddy/creddy --attribute --issuer Party_ID.pem --key Party_private.pem --role "$about_party" --subject-cert Party_ID.pem --subject-role  "$guestof_marchhare" --out party_about_party__guestof_marchhare_attr.der

echo "  "
echo "double checking with creddy --roles -certs party_about_party__guestof_marchhare_attr.der"
creddy --roles --cert party_about_party__guestof_marchhare_attr.der



