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() # load attribute cert into the context ctxt.load_attribute_chunk(attr.cert_chunk()) # another way to load the attribute cert into the context, # ctxt.load_attribute(attr)
exit(1) # load the ID and its key id = None cid = None try: id = ID(argv[1]) id.load_privkey(argv[2]) cid = ID(argv[4]) 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 #XXX not implemented yet...ctxt.load_id(cid) ctxt.load_id_chunk(cid.cert_chunk()) #out = ctxt.credentials() #print "\n...final principal set..." #for x in out[1]: # print "%s " % x.string() # create an attribute cert # iceCream.delicous <- chocolate attr = Attribute(id, "delicious", 1000) attr.principal(cid.keyid()) attr.bake()