source: examples/creddy_prover_tests/fruits_rt2/README @ 880e924

mei_rt2mei_rt2_fix_1
Last change on this file since 880e924 was f824a9e, checked in by Mei <mei@…>, 12 years ago

1) add more doc to python_tests

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