#!/bin/sh # # This demonstrates assigning objects to object sets (osets) based on their # membership in other sets. In this case there are 3 prinicpals. Mary and Bob # are encoding what fruits they are willing to eat in the oset Bob.what2eat and # Mary.what2eat. Ralphs is defining the prices of the fruits it sells by # assigning them to osets parameterized by price. # # Credential 1 lays out Mary's policy - she will eat fruits that cost less that # or equal to 2.00. Bob will eat fruits that cost between 1.00 and 5.00, as # laid out in Credential 2. Strictly speaking Bob and Mary's ruls apply to # prices assigned by Ralphs. Credentials 3-6 are Ralph's price assignments: # # Fruit Price Credential # apple 1.50 3 # kiwi 1.50 4 # black rsaberry 2.50 5 # navel ornage 0.50 6 # # The attached ./run_query file proves that Mary will eat a naval orange and a kiwi, # and that Bob will not eat a navel orange (too cheap). It also proves a apple # is priced at 1.50 and that it cannot prove that a green apple is priced at # 1.50 (we don't know anything about green apples). # fruits_rt2_typed # mary.what2eat<-?-navel orange good # mary.what2eat<-?-kiwi good # bob.what2eat<-?-navel orange bad # ralphs.fruitprice(1.50)<-?-apple good # ralphs.fruitprice(1.50)<-?-green apple bad creddy --generate --cn Mary creddy --generate --cn Bob creddy --generate --cn Ralphs mary_keyid=`creddy --keyid --cert Mary_ID.pem` bob_keyid=`creddy --keyid --cert Bob_ID.pem` ralphs_keyid=`creddy --keyid --cert Ralphs_ID.pem` fruitprice_qP="fruitprice([float:?P:[..2.00]])" fruitprice_qP_2="fruitprice([float:?P:[1.00..5.00]])" # [keyid:mary].oset:what2eat # <- [keyid:ralphs].oset:fruitprice([float:?P:[..2.00]]) # Credential 1 creddy --attribute \ --issuer Mary_ID.pem --key Mary_private.pem --oset "what2eat" \ --subject-cert Ralphs_ID.pem --subject-oset "$fruitprice_qP" \ --out mary_what2eat__ralphs_fruitprice_qP_attr.der # [keyid:bob].oset:what2eat # <- [keyid:ralphs].oset:fruitprice([float:?P:[1.00..5.00]]) # Credential 2 creddy --attribute \ --issuer Bob_ID.pem --key Bob_private.pem --oset "what2eat" \ --subject-cert Ralphs_ID.pem --subject-oset "$fruitprice_qP_2" \ --out bob_what2eat__ralphs_fruitprice_qP_2_attr.der # [keyid:ralphs].oset:fruitprice([float:1.50]) <- [string:'apple'] # Credential 3 creddy --attribute \ --issuer Ralphs_ID.pem --key Ralphs_private.pem \ --oset "fruitprice([float:1.50])" \ --subject-obj "[string:'apple']" \ --out Ralphs_fruitprice__apple_attr.der # [keyid:ralphs].oset:fruitprice([float:1.50]) <- [string:'kiwi'] # Credential 4 creddy --attribute \ --issuer Ralphs_ID.pem --key Ralphs_private.pem \ --oset "fruitprice([float:1.50])" \ --subject-obj "[string:'kiwi']" \ --out Ralphs_fruitprice__kiwi_attr.der # [keyid:ralphs].oset:fruitprice([float:2.50]) <- [string:'black rasberry'] # Credential 5 creddy --attribute \ --issuer Ralphs_ID.pem --key Ralphs_private.pem \ --oset "fruitprice([float:2.50])" \ --subject-obj "[string:'black rasberry']" \ --out Ralphs_fruitprice__black_rasberry_attr.der # [keyid:ralphs].oset:fruitprice([float:0.50]) <- [string:'navel orange'] # Credential 6 creddy --attribute \ --issuer Ralphs_ID.pem --key Ralphs_private.pem \ --oset "fruitprice([float:0.50])" \ --subject-obj "[string:'navel orange']" \ --out Ralphs_fruitprice__navel_orange_attr.der ##################################################################### # mary.what2eat <- ralphs.fruitsprice(?P:[..2.00]) # [keyid:mary].oset:what2eat # <- [keyid:ralphs].oset:fruitprice([float:?P:[..2.00]]) # # bob.what2eat <- ralphs.fruitsprice(?P:[1.00..5.00]) # [keyid:bob].oset:what2eat # <- [keyid:ralphs].oset:fruitprice([float:?P:[1.00..5.00]]) # # ralphs.fruitprice(1.50)<-apple # [keyid:ralphs].oset:fruitprice([float:1.50]) <- [string:'apple'] # # ralphs.fruitprice(2.50)<-black rasberry # [keyid:ralphs].oset:fruitprice([float:2.50]) <- [string:'black rasberry'] # # ralphs.fruitprice(0.50)<-navel orange # [keyid:ralphs].oset:fruitprice([float:0.50]) <- [string:'navel orange'] #