abac0-leakabac0-meimei-idmei-rt0-nmei_rt0tvf-new-xml
Last change
on this file since c00fcc3 was
be6cb41,
checked in by Mei <mei@…>, 12 years ago
|
1) forgot to add the new files
|
-
Property mode set to
100755
|
File size:
1.1 KB
|
Rev | Line | |
---|
[be6cb41] | 1 | #!/usr/bin/env python |
---|
| 2 | |
---|
| 3 | """ |
---|
| 4 | to test when an id gets loaded into the session |
---|
| 5 | vs when it gets loaded into a context |
---|
| 6 | |
---|
| 7 | cmd:env keystore=`pwd` ./id_ctxt.py |
---|
| 8 | |
---|
| 9 | """ |
---|
| 10 | |
---|
| 11 | import os |
---|
| 12 | import ABAC |
---|
| 13 | |
---|
| 14 | def pSZ(CTXT,msg): |
---|
| 15 | psz= CTXT.principal_count() |
---|
| 16 | csz= CTXT.credential_count() |
---|
| 17 | print "context [%s] %d principals, %d credentials" % (msg,psz,csz) |
---|
| 18 | |
---|
| 19 | ctxtA = ABAC.Context() |
---|
| 20 | ctxtB = ABAC.Context() |
---|
| 21 | |
---|
| 22 | ABAC.dump_debug_info("first") |
---|
| 23 | pSZ(ctxtA, "A") |
---|
| 24 | pSZ(ctxtB, "B") |
---|
| 25 | |
---|
| 26 | ## creating and writing out using libabac ID |
---|
| 27 | id=ABAC.ID("Ella", 0) |
---|
| 28 | print "adding -> %s(good) to session" % id.id_name() |
---|
| 29 | id.id_write_cert("Ella_ID.pem") |
---|
| 30 | id.id_write_privkey("Ella_private.pem") |
---|
| 31 | |
---|
| 32 | ABAC.dump_debug_info("second") |
---|
| 33 | pSZ(ctxtA, "A") |
---|
| 34 | pSZ(ctxtB, "B") |
---|
| 35 | |
---|
| 36 | ## load principal with id/key file pair |
---|
| 37 | ## note, with this, we do not have handle on the keyid |
---|
| 38 | ## to Ella but it will be in the db |
---|
| 39 | print "loading -> %s to ctxtA" % id.id_name() |
---|
| 40 | ctxtA.load_id_files("Ella_ID.pem","Ella_private.pem") |
---|
| 41 | |
---|
| 42 | print "loading -> Bob to ctxtB" |
---|
| 43 | ctxtB.load_id_files("Bob_ID.pem","Bob_private.pem") |
---|
| 44 | |
---|
| 45 | ABAC.dump_debug_info("third") |
---|
| 46 | pSZ(ctxtA, "A") |
---|
| 47 | pSZ(ctxtB, "B") |
---|
Note: See
TracBrowser
for help on using the repository browser.