source: tests/example_scripts/wiki/ctxtQuery4_setup.py @ 081eabc

abac0-leakabac0-mei
Last change on this file since 081eabc was 65e3c6b, checked in by Mei <mei@…>, 11 years ago

1) fixed an off by one bug in expand_key

  • Property mode set to 100755
File size: 935 bytes
RevLine 
[bceef20]1#!/usr/bin/env python
2"""
3ctxtQuery4_setup.py
4 
5creating a abac attribute credential
6   acme.experiment_create <- acme
7
8"""
9import os
10import sys
11import ABAC
12
13ctx = ABAC.Context()
14
15## note id did not get loaded into ctx and so keyid map is not generated
16## hence no mnemonic table
17acme = ABAC.ID("Acme", 24 * 3600 * 365 * 20)
18attr = ABAC.Attribute(acme, "experiment_create", 24 * 3600 * 365 * 20)
19attr.principal(acme.keyid())
20attr.bake(ctx)
21attr.write_file("abac_cred.xml")
22
23coyote = ABAC.ID("Coyote", 24 * 3600 * 365 * 20)
24ctx.load_id_chunk(coyote.cert_chunk())
25attr2 = ABAC.Attribute(coyote, "lives_dangerously", 24 * 3600 * 365 * 20)
26attr2.principal(acme.keyid())
27attr2.bake(ctx)
28attr2.write_file("coyote.xml")
[65e3c6b]29
30bird = ABAC.ID("BigBird", 24 * 3600 * 365 * 20)
31ctx.load_id_chunk(bird.cert_chunk())
32attr3 = ABAC.Attribute(bird, "nice", 24 * 3600 * 365 * 20)
33attr3.principal(acme.keyid())
34attr3.bake(ctx)
35attr3.write_file("bird.xml")
36
Note: See TracBrowser for help on using the repository browser.