[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] | 20 | rm -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 | |
---|
| 25 | creddy --generate --cn StateU |
---|
| 26 | creddy --generate --cn Bob |
---|
| 27 | creddy --generate --cn Mark |
---|
| 28 | creddy --generate --cn Joe |
---|
| 29 | creddy --generate --cn Maryann |
---|
| 30 | creddy --generate --cn Jan |
---|
| 31 | |
---|
| 32 | stateU_keyid=`creddy --keyid --cert StateU_ID.pem` |
---|
| 33 | |
---|
| 34 | bob_keyid=`creddy --keyid --cert Bob_ID.pem` |
---|
| 35 | mark_keyid=`creddy --keyid --cert Mark_ID.pem` |
---|
| 36 | joe_keyid=`creddy --keyid --cert Joe_ID.pem` |
---|
| 37 | maryann_keyid=`creddy --keyid --cert Maryann_ID.pem` |
---|
| 38 | jan_keyid=`creddy --keyid --cert Jan_ID.pem` |
---|
| 39 | |
---|
| 40 | diploma_q_qY="diploma([string:?D:['mathmatics','psychology']], [integer:?Year:[1960,1961,1963]])" |
---|
| 41 | |
---|
| 42 | diploma_m="diploma([string:'mathmatics'],[integer:1961])" |
---|
| 43 | diploma_mm="diploma([string:'mathmatics'],[integer:1965])" |
---|
| 44 | diploma_z="diploma([string:'zoology'],[integer:1961])" |
---|
| 45 | diploma_p="diploma([string:'psychology'],[integer:1962])" |
---|
| 46 | diploma_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] | 51 | creddy --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] | 58 | creddy --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] | 65 | creddy --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] | 72 | creddy --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] | 79 | creddy --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] | 86 | creddy --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 | |
---|