source: tests/python_tests/basic_id/id_ctxt.py @ 3c30b59

abac0-leakabac0-mei
Last change on this file since 3c30b59 was 3c30b59, checked in by Mei <mei@…>, 11 years ago

1) add in new refactored regression testing directory
2) undo the abac.hh/ABAC.hh api changes
3) merged with Ted's changes to attribute format/nickname/issuer processing

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