source: examples/fruits_rt2_typed/README @ 2c01913

mei_rt2mei_rt2_fix_1meiyap-rt1rt2
Last change on this file since 2c01913 was 2c01913, checked in by Ted Faber <faber@…>, 13 years ago

Added docs

  • Property mode set to 100755
File size: 4.2 KB
Line 
1#!/bin/sh
2
3rm -rf *.der *.pem
4
5# This demonstrates assigning objects to object sets (osets) based on their
6# membership in other sets.  In this case there are 3 prinicpals. Mary and Bob
7# are encoding what fruits they are willing to eat in the oset Bob.what2eat and
8# Mary.what2eat.  Ralphs is defining the prices of the fruits it sells by
9# assigning them to osets parameterized by price.
10#
11# Credential 1 lays out Mary's policy - she will eat fruits that cost less that
12# or equal to 2.00.  Bob will eat fruits that cost between 1.00 and 5.00, as
13# laid out in Credential 2.  Strictly speaking Bob and Mary's ruls apply to
14# prices assigned by Ralphs.  Credentials 3-6 are Ralph's price assignments:
15#
16# Fruit               Price      Credential
17# apple               1.50       3
18# kiwi                1.50       4
19# black rsaberry      2.50       5
20# navel ornage        0.50       6
21#
22# The attached ./rr file proves that Mary will eat a naval orange and a kiwi,
23# and that Bob will not eat a navel orange (too cheap).  It also proves a apple
24# is priced at 1.50 and that it cannot prove that a green apple is priced at
25# 1.50 (we don't know anything about green apples).
26
27# mary.what2eat<-?-navel orange  good
28# mary.what2eat<-?-kiwi  good
29# bob.what2eat<-?-navel orange  bad
30# ralphs.fruitprice(1.50)<-?-apple   good
31
32creddy --generate --cn Mary
33creddy --generate --cn Bob
34creddy --generate --cn Ralphs
35
36mary_keyid=`creddy --keyid --cert Mary_ID.pem`
37bob_keyid=`creddy --keyid --cert Bob_ID.pem`
38ralphs_keyid=`creddy --keyid --cert Ralphs_ID.pem`
39
40fruitprice_qP="fruitprice([float:?P:[..2.00]])"
41fruitprice_qP_2="fruitprice([float:?P:[1.00..5.00]])"
42
43# [keyid:mary].oset:what2eat
44#      <- [keyid:ralphs].oset:fruitprice([float:?P:[..2.00]])
45# Credential 1
46creddy --attribute \
47       --issuer Mary_ID.pem --key Mary_private.pem --oset "what2eat" \
48       --subject-cert Ralphs_ID.pem --subject-oset "$fruitprice_qP" \
49       --out mary_what2eat__ralphs_fruitprice_qP_attr.der
50
51# [keyid:bob].oset:what2eat
52#      <- [keyid:ralphs].oset:fruitprice([float:?P:[1.00..5.00]])
53# Credential 2
54creddy --attribute \
55       --issuer Bob_ID.pem --key Bob_private.pem --oset "what2eat" \
56       --subject-cert Ralphs_ID.pem --subject-oset "$fruitprice_qP_2" \
57       --out bob_what2eat__ralphs_fruitprice_qP_2_attr.der
58
59# [keyid:ralphs].oset:fruitprice([float:1.50]) <- [string:'apple']
60# Credential 3
61creddy --attribute \
62        --issuer Ralphs_ID.pem --key Ralphs_private.pem \
63        --oset "fruitprice([float:1.50])" \
64        --subject-obj "[string:'apple']" \
65        --out Ralphs_fruitprice__apple_attr.der
66
67# [keyid:ralphs].oset:fruitprice([float:1.50]) <- [string:'kiwi']
68# Credential 4
69creddy --attribute \
70        --issuer Ralphs_ID.pem --key Ralphs_private.pem \
71        --oset "fruitprice([float:1.50])" \
72        --subject-obj "[string:'kiwi']" \
73        --out Ralphs_fruitprice__kiwi_attr.der
74
75
76# [keyid:ralphs].oset:fruitprice([float:2.50]) <- [string:'black rasberry']
77# Credential 5
78creddy --attribute \
79        --issuer Ralphs_ID.pem --key Ralphs_private.pem \
80        --oset "fruitprice([float:2.50])" \
81        --subject-obj "[string:'black rasberry']" \
82        --out Ralphs_fruitprice__black_rasberry_attr.der
83
84# [keyid:ralphs].oset:fruitprice([float:0.50]) <- [string:'navel orange']
85# Credential 6
86creddy --attribute \
87        --issuer Ralphs_ID.pem --key Ralphs_private.pem \
88        --oset "fruitprice([float:0.50])" \
89        --subject-obj "[string:'navel orange']" \
90        --out Ralphs_fruitprice__navel_orange_attr.der
91
92#####################################################################
93# mary.what2eat <- ralphs.fruitsprice(?P:[..2.00])
94# [keyid:mary].oset:what2eat
95#      <- [keyid:ralphs].oset:fruitprice([float:?P:[..2.00]])
96#
97# bob.what2eat <- ralphs.fruitsprice(?P:[1.00..5.00])
98# [keyid:bob].oset:what2eat
99#      <- [keyid:ralphs].oset:fruitprice([float:?P:[1.00..5.00]])
100#
101# ralphs.fruitprice(1.50)<-apple
102# [keyid:ralphs].oset:fruitprice([float:1.50]) <- [string:'apple']
103#
104# ralphs.fruitprice(2.50)<-black rasberry
105# [keyid:ralphs].oset:fruitprice([float:2.50]) <- [string:'black rasberry']
106#
107# ralphs.fruitprice(0.50)<-navel orange
108# [keyid:ralphs].oset:fruitprice([float:0.50]) <- [string:'navel orange']
109#
110
Note: See TracBrowser for help on using the repository browser.