source: tests/example_scripts/wiki/id5.py @ ec550f7

abac0-leakabac0-meimei-idtvf-new-xml
Last change on this file since ec550f7 was ec550f7, checked in by Mei <mei@…>, 11 years ago

1) reworked how API doc is generated
2) tweak top level Makefile.am
3) loading issuer principal as side-effect of loading

an attribute credentials

4) add examples of GENI specific attribute credentials

and principal certificates into the regression testing

5) rename examples to tests

  • Property mode set to 100755
File size: 756 bytes
Line 
1#!/usr/bin/env python
2"""
3id4.py
4"""
5import os
6import ABAC
7
8id = ABAC.ID("newGuy", 5*365*3600*24)
9
10id.write_cert_file("./newGuy.pem")
11id.write_privkey_file("./newGuy.pem")
12
13id1 = ABAC.ID("./newGuy.pem")
14id1.load_privkey("./newGuy.pem")
15
16id2 = ABAC.ID("./newGuy.pem")
17
18try:
19    f = open("./newGuy.pem")
20    id3 = ABAC.ID_chunk(f.read())
21    f.close()
22except:
23    pass
24
25try:
26    f = open("./newGuy.pem")
27    id4 = ABAC.ID_chunk(f.read())
28    f.seek(0,0) 
29    id4.load_privkey_chunk(f.read())
30    f.close()
31except:
32    pass
33
34print "id has privkey %d" % id.has_privkey()
35print "id1 has privkey %d" % id1.has_privkey()
36print "id2 has privkey %d" % id2.has_privkey()
37print "id3 has privkey %d" % id3.has_privkey()
38print "id4 has privkey %d" % id4.has_privkey()
39
Note: See TracBrowser for help on using the repository browser.