source: examples/creddy_prover_tests/alumni3_rt1/README @ 5f551d3

mei_rt2mei_rt2_fix_1
Last change on this file since 5f551d3 was 5110d42, checked in by Mei <mei@…>, 13 years ago

1) reorganized the test directory to include python tests
2) attribute via api and principal via api from python scripts is

working (although there is a annoying seg fault at the very end
that must be related to something not been dup()ed.. need to wait
for c example to debug it)

3) able to query via api
4) replicated access_rt2 example in python and the query result matches
5) expanded api to make it easier to generate rt2 structure

  • Property mode set to 100755
File size: 3.8 KB
RevLine 
[acf3ff9]1#!/bin/sh
[9502c50]2#
[2c01913]3# This example shows an example of reasoning about a role's parameters.  There
4# are 4 principals StateU, Bob, Mark, Maryann, Joe, and Jan.  StateU wants to
5# establish a set of founding alumni based on the year of graduation.  On
6# graduation each alum has previously been issued a credential parameterized
7# with their major and graduation year.  StateU sets up a policy that says that
8# a principal is a founding alum if they graduated in 1960, 1961, or 1963 in
9# either mathematics or psychology.  One assumes there was some kind of NCAA
10# suspension in 1962.  This policy is expressed in Credential 1.
11#
12# Credentials 2, 3, 4, 5, and 6 each assign a diploma credential to Bob (a 1961
13# mathematics degree), Mark (a 1965 mathematics degree), Joe (a 1961 zoology degree), Maryann (a 1962 psychology degree), and Jan (a 1960 psychology degree)
14#
[9502c50]15# The attached ./run_query file asks if each of these principals are favored
16# alums, and only Bob and Jan are.
[2c01913]17
[9502c50]18# alumni3_rt1_typed
[2c01913]19
[acf3ff9]20rm -rf *.der *.pem
21# [keyid:stateU].role:foundingAlumni <-?- [keyid:Bob] (yes)
22# [keyid:stateU].role:foundingAlumni <-?- [keyid:Maryann] (no)
23# [keyid:stateU].role:foundingAlumni <-?- [keyid:Joe] (no)
24
25creddy --generate --cn StateU
26creddy --generate --cn Bob
27creddy --generate --cn Mark
28creddy --generate --cn Joe
29creddy --generate --cn Maryann
30creddy --generate --cn Jan
31
32stateU_keyid=`creddy --keyid --cert StateU_ID.pem`
33
34bob_keyid=`creddy --keyid --cert Bob_ID.pem`
35mark_keyid=`creddy --keyid --cert Mark_ID.pem`
36joe_keyid=`creddy --keyid --cert Joe_ID.pem`
37maryann_keyid=`creddy --keyid --cert Maryann_ID.pem`
38jan_keyid=`creddy --keyid --cert Jan_ID.pem`
39
40diploma_q_qY="diploma([string:?D:['mathmatics','psychology']], [integer:?Year:[1960,1961,1963]])"
41
42diploma_m="diploma([string:'mathmatics'],[integer:1961])"
43diploma_mm="diploma([string:'mathmatics'],[integer:1965])"
44diploma_z="diploma([string:'zoology'],[integer:1961])"
45diploma_p="diploma([string:'psychology'],[integer:1962])"
46diploma_pp="diploma([string:'psychology'],[integer:1960])"
47
48# [keyid:stateU].role:foundingAlumni
49#                   <- [keyid:stateU].role:diploma([string:?D:['mathmatics','psychology']], [integer:?Year:[1960,1961,1963]])
[2c01913]50# Credential 1
[acf3ff9]51creddy --attribute \
52       --issuer StateU_ID.pem --key StateU_private.pem --role "foundingAlumni" \
53       --subject-cert StateU_ID.pem --subject-role "$diploma_q_qY" \
54       --out StateU_foundingAlumni__stateU_diploma_q_qY_attr.der
55
56# [keyid:stateU].role:diploma([string:'mathmatics'],[integer:1961]) <- [keyid:bob]
[2c01913]57# Credential 2
[acf3ff9]58creddy --attribute \
59        --issuer StateU_ID.pem --key StateU_private.pem --role "$diploma_m" \
60        --subject-cert Bob_ID.pem \
61        --out StateU_diploma_m__Bob_attr.der
62
63# [keyid:stateU].role:diploma([string:'mathmatics'],[integer:1965]) <- [keyid:mark]
[2c01913]64# Credential 3
[acf3ff9]65creddy --attribute \
66        --issuer StateU_ID.pem --key StateU_private.pem --role "$diploma_mm" \
67        --subject-cert Mark_ID.pem \
68        --out StateU_diploma_mm__Mark_attr.der
69
70# [keyid:stateU].role:diploma([string:'zoology'],[integer:1961]) <- [keyid:joe]
[2c01913]71# Credential 4
[acf3ff9]72creddy --attribute \
73        --issuer StateU_ID.pem --key StateU_private.pem --role "$diploma_z" \
74        --subject-cert Joe_ID.pem \
75        --out StateU_diploma_z__Joe_attr.der
76
77# [keyid:stateU].role:diploma([string:'psychology'],[integer:1962]) <- [keyid:maryann]
[2c01913]78# Credential 5
[acf3ff9]79creddy --attribute \
80        --issuer StateU_ID.pem --key StateU_private.pem --role "$diploma_p" \
81        --subject-cert Maryann_ID.pem \
82        --out StateU_diploma_p__Maryann_attr.der
83
84# [keyid:stateU].role:diploma([string:'psychology'],[integer:1960]) <- [keyid:jan]
[2c01913]85# Credential 6
[acf3ff9]86creddy --attribute \
87        --issuer StateU_ID.pem --key StateU_private.pem --role "$diploma_pp" \
88        --subject-cert Jan_ID.pem \
89        --out StateU_diploma_pp__Jan_attr.der
90
Note: See TracBrowser for help on using the repository browser.