source: examples/scaling_tests/daisychain/likes_python/base/ATTR.py @ 658e7ef

mei_rt2mei_rt2_fix_1
Last change on this file since 658e7ef was 2485307, checked in by Mei <mei@…>, 12 years ago

1) wrap up the changes on proof buffer's process in abac_pl_yap.c
2) update some doc
3) wrap up the scaling tests(big daisy chains)

  • Property mode set to 100755
File size: 1.5 KB
Line 
1#!/usr/bin/env python
2
3"""
4See README in this directory for the semantics of the example.  This file
5constructs the credentials described and puts copies into this directory
6
7cmd1:env keystore=`pwd` ./attr.py
8"""
9
10import os
11import ABAC
12
13ctxt = ABAC.Context()
14print "ABAC version %s" % ctxt.version()
15
16# Keystore is the directory containing the principal credentials.
17# Load existing principals and/or policy credentials
18if (os.environ.has_key("keystore")) :
19    keystore=os.environ["keystore"]
20    ctxt.load_directory(keystore)
21else:
22    print("keystore is not set...")
23    exit(1)
24
25################################################
26# [keyid:john0].role:likes  <- [keyid:john0]
27a="John0_ID.pem"
28ap="John0_private.pem"
29f="John0_likes__John0_attr.der" 
30   
31aID=ABAC.ID(a);
32aID.id_load_privkey_file(ap);
33aid=aID.id_keyid()
34
35head = ABAC.Role(aid,"likes")
36tail = ABAC.Role(aid)
37attr=ABAC.Attribute(head, 18000)
38attr.attribute_add_tail(tail)
39attr.attribute_bake()
40attr.attribute_write_cert(f)
41
42# [keyid:john1].role:likes  <- [keyid:john0].role:likes
43i=1
44while i <= #VAL#:
45    n=i-1
46
47    a="John%s_ID.pem"%i
48    ap="John%s_private.pem"%i
49    b="John%s_ID.pem"%n
50    f="John%s_likes__John%s_likes_attr.der" %(i,n)
51   
52    aID=ABAC.ID(a);
53    aID.id_load_privkey_file(ap);
54    aid=aID.id_keyid()
55    bID=ABAC.ID(b);
56    bid=bID.id_keyid()
57
58    head = ABAC.Role(aid,"likes")
59    tail = ABAC.Role(bid,"likes")
60    attr=ABAC.Attribute(head, 18000)
61    attr.attribute_add_tail(tail)
62    attr.attribute_bake()
63    attr.attribute_write_cert(f)
64    i=i+1
65
Note: See TracBrowser for help on using the repository browser.