abac0-leakabac0-meimei-idmei-rt0-nmei_rt0tvf-new-xml
Last change
on this file since ecb1628 was
7e3f5e2,
checked in by Mei <mei@…>, 12 years ago
|
1) converted daisychain scaling tests
|
-
Property mode set to
100755
|
File size:
1.3 KB
|
Line | |
---|
1 | #!/usr/bin/env python |
---|
2 | |
---|
3 | """ |
---|
4 | See README in this directory for the semantics of the example. This file |
---|
5 | constructs the credentials described and puts copies into this directory |
---|
6 | |
---|
7 | cmd1:env keystore=`pwd` ./attr.py |
---|
8 | """ |
---|
9 | |
---|
10 | import os |
---|
11 | import ABAC |
---|
12 | |
---|
13 | ctxt = ABAC.Context() |
---|
14 | |
---|
15 | # Keystore is the directory containing the principal credentials. |
---|
16 | # Load existing principals and/or policy credentials |
---|
17 | if (os.environ.has_key("keystore")) : |
---|
18 | keystore=os.environ["keystore"] |
---|
19 | ctxt.load_directory(keystore) |
---|
20 | else: |
---|
21 | print("keystore is not set...") |
---|
22 | exit(1) |
---|
23 | |
---|
24 | ################################################ |
---|
25 | # [keyid:john0].role:likes <- [keyid:john0] |
---|
26 | a="John0_ID.pem" |
---|
27 | ap="John0_private.pem" |
---|
28 | f="John0_likes__John0_attr.xml" |
---|
29 | |
---|
30 | aID=ABAC.ID(a); |
---|
31 | aID.load_privkey(ap); |
---|
32 | aid=aID.keyid() |
---|
33 | |
---|
34 | attr = ABAC.Attribute(aID, "likes", 0) |
---|
35 | attr.principal(aid) |
---|
36 | attr.bake() |
---|
37 | attr.write_file(f) |
---|
38 | |
---|
39 | # [keyid:john1].role:likes <- [keyid:john0].role:likes |
---|
40 | i=1 |
---|
41 | while i <= #VAL#: |
---|
42 | n=i-1 |
---|
43 | |
---|
44 | a="John%s_ID.pem"%i |
---|
45 | ap="John%s_private.pem"%i |
---|
46 | b="John%s_ID.pem"%n |
---|
47 | f="John%s_likes__John%s_likes_attr.xml" %(i,n) |
---|
48 | |
---|
49 | aID=ABAC.ID(a); |
---|
50 | aID.load_privkey(ap); |
---|
51 | aid=aID.keyid() |
---|
52 | bID=ABAC.ID(b); |
---|
53 | bid=bID.keyid() |
---|
54 | |
---|
55 | attr = ABAC.Attribute(aID,"likes", 0) |
---|
56 | attr.role(bid,"likes") |
---|
57 | attr.bake() |
---|
58 | attr.write_file(f) |
---|
59 | i=i+1 |
---|
60 | |
---|
Note: See
TracBrowser
for help on using the repository browser.