from ABAC import ID, Attribute, Role debug=0 ## initial context ctxt = Context() if len(argv) != 6: print "Usage: abac_attr.py <cert.pem> <key.pem> <attr.xml> <pfile> <c_cert.pem>" exit(1) # load the ID and its key id = None try: id = ID(argv[1]) id.load_privkey(argv[2]) cream_id = ID(argv[5]) except Exception, e: print "Problem loading ID cert: %s" % e exit(1) # load the id into the context ctxt.load_id_chunk(id.cert_chunk()) # another way to load the id into the context # ctxt.load_id(cream_id), not implemented ctxt.load_id_chunk(cream_id.cert_chunk()) # create an attribute cert attr = Attribute(id, "delicious", 1000) attr.principal(cream_id.keyid()) attr.bake()