abac0-leakabac0-mei
Last change
on this file since 84038c8 was
bceef20,
checked in by Mei <mei@…>, 11 years ago
|
1) add the new tests
|
-
Property mode set to
100755
|
File size:
957 bytes
|
Line | |
---|
1 | #!/usr/bin/env python |
---|
2 | """ |
---|
3 | ctxtQuery4.py |
---|
4 | |
---|
5 | shows use of mnemonic name for principals |
---|
6 | |
---|
7 | """ |
---|
8 | import os |
---|
9 | import ABAC |
---|
10 | |
---|
11 | ctx = ABAC.Context() |
---|
12 | |
---|
13 | ctx.load_attribute_file('./abac_cred.xml') |
---|
14 | ctx.load_attribute_file('./coyote.xml') |
---|
15 | |
---|
16 | for c in ctx.credentials(): |
---|
17 | print "Raw: %s -> %s" % (c.head().string(), c.tail().string()) |
---|
18 | print "Short: %s -> %s" % (c.head().short_string(ctx), c.tail().short_string(ctx)) |
---|
19 | |
---|
20 | # Collect the identity keyids into ids |
---|
21 | ids = [] |
---|
22 | for c in ctx.credentials(): |
---|
23 | i = ABAC.ID_chunk(c.issuer_cert()) |
---|
24 | if i.keyid() not in ids: |
---|
25 | ids.append(i.keyid()) |
---|
26 | |
---|
27 | # Change all the nicknames |
---|
28 | for n, i in enumerate(ids): |
---|
29 | print ctx.set_nickname(i, "identity%d" % n) |
---|
30 | |
---|
31 | # Print the credentials with the new nicknames |
---|
32 | print "" |
---|
33 | print "After modifications" |
---|
34 | print "" |
---|
35 | for c in ctx.credentials(): |
---|
36 | print "Raw: %s -> %s" % (c.head().string(), c.tail().string()) |
---|
37 | print "Short: %s -> %s" % (c.head().short_string(ctx), c.tail().short_string(ctx)) |
---|
38 | |
---|
Note: See
TracBrowser
for help on using the repository browser.