abac0-leakabac0-mei
Last change
on this file since 2be12d2 was
7c748c9,
checked in by Mei <mei@…>, 11 years ago
|
1) more new tests
|
-
Property mode set to
100755
|
File size:
882 bytes
|
Rev | Line | |
---|
[7c748c9] | 1 | #!/usr/bin/env python |
---|
| 2 | """ |
---|
| 3 | ctxtQuery3.py |
---|
| 4 | |
---|
| 5 | shows auto loading of self-contained attribute |
---|
| 6 | |
---|
| 7 | externally, |
---|
| 8 | make a, |
---|
| 9 | make b, |
---|
| 10 | make c, |
---|
| 11 | make a.yes <- c |
---|
| 12 | make b.no <- c |
---|
| 13 | |
---|
| 14 | load a |
---|
| 15 | load a.yes <-c |
---|
| 16 | load b.no <- c |
---|
| 17 | |
---|
| 18 | query b.no <-?-c |
---|
| 19 | query a.yes <-?-c |
---|
| 20 | |
---|
| 21 | todo, dump principals |
---|
| 22 | """ |
---|
| 23 | import os |
---|
| 24 | |
---|
| 25 | import ABAC |
---|
| 26 | ctxt = ABAC.Context() |
---|
| 27 | |
---|
| 28 | aID=ABAC.ID("A_ID.pem"); |
---|
| 29 | a=aID.keyid() |
---|
| 30 | bID=ABAC.ID("B_ID.pem"); |
---|
| 31 | b=bID.keyid() |
---|
| 32 | cID=ABAC.ID("C_ID.pem"); |
---|
| 33 | c=cID.keyid() |
---|
| 34 | |
---|
| 35 | ctxt.load_id_chunk(aID.cert_chunk()) |
---|
| 36 | ctxt.load_attribute_file("A_yes__C_attr.xml") |
---|
| 37 | ctxt.load_attribute_file("B_no__C_attr.xml") |
---|
| 38 | |
---|
| 39 | # Same code as above to initialize the ids and load the context |
---|
| 40 | |
---|
| 41 | ok, proof = ctxt.query(a + ".yes", c) |
---|
| 42 | print "regular, ok? %d" %ok |
---|
| 43 | |
---|
| 44 | ok, proof = ctxt.query(b + ".no", c) |
---|
| 45 | print "self contain, ok? %d" %ok |
---|
| 46 | |
---|
| 47 | ## should also dump the context principal to make sure b is not in the |
---|
| 48 | ## context |
---|
Note: See
TracBrowser
for help on using the repository browser.