[373bf68] | 1 | #!/bin/sh |
---|
| 2 | # |
---|
| 3 | # This demonstrates scalability of libabac. The fruit_rt2 test from |
---|
| 4 | # creddy_prover_tests is use as the base. |
---|
| 5 | # #VAL# simple attribute credentials are added, |
---|
| 6 | # #VAL# complex attribute credentials along |
---|
| 7 | # with #VAL# different principal ids are added. |
---|
| 8 | # The same queries used in fruit_rt2 are run against this setup and |
---|
| 9 | # should yield the same result |
---|
| 10 | |
---|
| 11 | # fruits_rt2_creddy |
---|
| 12 | |
---|
| 13 | # mary.what2eat<-?-navel orange good |
---|
| 14 | # mary.what2eat<-?-kiwi good |
---|
| 15 | # bob.what2eat<-?-navel orange bad |
---|
| 16 | # ralphs.fruitprice(1.50)<-?-apple good |
---|
| 17 | # ralphs.fruitprice(1.50)<-?-green apple bad |
---|
| 18 | |
---|
| 19 | creddy --generate --cn Mary |
---|
| 20 | creddy --generate --cn Bob |
---|
| 21 | creddy --generate --cn Ralphs |
---|
| 22 | |
---|
| 23 | fruitprice_qP="fruitprice([float:?P:[..2.00]])" |
---|
| 24 | fruitprice_qP_2="fruitprice([float:?P:[1.00..5.00]])" |
---|
| 25 | |
---|
| 26 | # [keyid:mary].oset:what2eat |
---|
| 27 | # <- [keyid:ralphs].oset:fruitprice([float:?P:[..2.00]]) |
---|
| 28 | # Credential 1 |
---|
| 29 | creddy --attribute \ |
---|
| 30 | --issuer Mary_ID.pem --key Mary_private.pem --oset "what2eat" \ |
---|
| 31 | --subject-cert Ralphs_ID.pem --subject-oset "$fruitprice_qP" \ |
---|
| 32 | --out mary_what2eat__ralphs_fruitprice_qP_attr.der |
---|
| 33 | |
---|
| 34 | # [keyid:bob].oset:what2eat |
---|
| 35 | # <- [keyid:ralphs].oset:fruitprice([float:?P:[1.00..5.00]]) |
---|
| 36 | # Credential 2 |
---|
| 37 | creddy --attribute \ |
---|
| 38 | --issuer Bob_ID.pem --key Bob_private.pem --oset "what2eat" \ |
---|
| 39 | --subject-cert Ralphs_ID.pem --subject-oset "$fruitprice_qP_2" \ |
---|
| 40 | --out bob_what2eat__ralphs_fruitprice_qP_2_attr.der |
---|
| 41 | |
---|
| 42 | # [keyid:ralphs].oset:fruitprice([float:1.50]) <- [string:'apple'] |
---|
| 43 | # Credential 3 |
---|
| 44 | creddy --attribute \ |
---|
| 45 | --issuer Ralphs_ID.pem --key Ralphs_private.pem \ |
---|
| 46 | --oset "fruitprice([float:1.50])" \ |
---|
| 47 | --subject-obj "[string:'apple']" \ |
---|
| 48 | --out Ralphs_fruitprice__apple_attr.der |
---|
| 49 | |
---|
| 50 | # [keyid:ralphs].oset:fruitprice([float:1.50]) <- [string:'kiwi'] |
---|
| 51 | # Credential 4 |
---|
| 52 | creddy --attribute \ |
---|
| 53 | --issuer Ralphs_ID.pem --key Ralphs_private.pem \ |
---|
| 54 | --oset "fruitprice([float:1.50])" \ |
---|
| 55 | --subject-obj "[string:'kiwi']" \ |
---|
| 56 | --out Ralphs_fruitprice__kiwi_attr.der |
---|
| 57 | |
---|
| 58 | |
---|
| 59 | # [keyid:ralphs].oset:fruitprice([float:2.50]) <- [string:'black rasberry'] |
---|
| 60 | # Credential 5 |
---|
| 61 | creddy --attribute \ |
---|
| 62 | --issuer Ralphs_ID.pem --key Ralphs_private.pem \ |
---|
| 63 | --oset "fruitprice([float:2.50])" \ |
---|
| 64 | --subject-obj "[string:'black rasberry']" \ |
---|
| 65 | --out Ralphs_fruitprice__black_rasberry_attr.der |
---|
| 66 | |
---|
| 67 | # [keyid:ralphs].oset:fruitprice([float:0.50]) <- [string:'navel orange'] |
---|
| 68 | # Credential 6 |
---|
| 69 | creddy --attribute \ |
---|
| 70 | --issuer Ralphs_ID.pem --key Ralphs_private.pem \ |
---|
| 71 | --oset "fruitprice([float:0.50])" \ |
---|
| 72 | --subject-obj "[string:'navel orange']" \ |
---|
| 73 | --out Ralphs_fruitprice__navel_orange_attr.der |
---|
| 74 | |
---|
| 75 | ############### NOISE ####################################### |
---|
| 76 | # [keyid:Ralphs].oset:fruitprice([float:X.00]) <- [string:bananaY] |
---|
| 77 | for i in $(seq 1 #VAL#); |
---|
| 78 | do |
---|
| 79 | fruit="banana$i" |
---|
| 80 | price="fruitprice([float:$i.00])" |
---|
| 81 | stuff="[string:'$fruit']" |
---|
| 82 | ostr="Ralphs_fruitprice__${fruit}_attr.der" |
---|
| 83 | creddy --attribute \ |
---|
| 84 | --issuer Ralphs_ID.pem --key Ralphs_private.pem \ |
---|
| 85 | --oset "$price" \ |
---|
| 86 | --subject-obj "$stuff" \ |
---|
| 87 | --out $ostr |
---|
| 88 | done |
---|
| 89 | |
---|
| 90 | # [keyid:johnX] |
---|
| 91 | # [keyid:johnX].oset:what2eat |
---|
| 92 | # <- [keyid:ralphs].oset:fruitprice([float:?P:[1.00..5.00]]) |
---|
| 93 | for i in $(seq 1 #VAL#); |
---|
| 94 | do |
---|
| 95 | name="John$i" |
---|
| 96 | creddy --generate --cn $name |
---|
| 97 | |
---|
| 98 | ostr="${name}_what2eat__ralphs_fruitprice_qP_2_attr.der" |
---|
| 99 | creddy --attribute \ |
---|
| 100 | --issuer ${name}_ID.pem --key ${name}_private.pem --oset "what2eat" \ |
---|
| 101 | --subject-cert Ralphs_ID.pem --subject-oset "$fruitprice_qP_2" \ |
---|
| 102 | --out $ostr |
---|
| 103 | done |
---|
| 104 | |
---|