abac0-leakabac0-mei
Last change
on this file since 7c748c9 was
bec30b5,
checked in by Mei <mei@…>, 11 years ago
|
1) change abac_context_load_directory to check on every regular files
and try to extract id id/privkey and then attribute in turn.
2) move id_certs to be context based instead of shared globally
|
-
Property mode set to
100755
|
File size:
1.1 KB
|
Rev | Line | |
---|
[a02c849] | 1 | #!/usr/bin/env python |
---|
| 2 | """ |
---|
| 3 | id4.py |
---|
| 4 | """ |
---|
| 5 | import os |
---|
| 6 | import ABAC |
---|
| 7 | |
---|
| 8 | id = ABAC.ID("newGuy", 5*365*3600*24) |
---|
[bec30b5] | 9 | oid = ABAC.ID("oldGuy", 5*365*3600*24) |
---|
| 10 | |
---|
| 11 | oid.write_cert_file("./oldGuy.pem") |
---|
[a02c849] | 12 | |
---|
| 13 | id.write_cert_file("./newGuy.pem") |
---|
| 14 | id.write_privkey_file("./newGuy.pem") |
---|
| 15 | |
---|
| 16 | id1 = ABAC.ID("./newGuy.pem") |
---|
| 17 | id1.load_privkey("./newGuy.pem") |
---|
| 18 | |
---|
| 19 | id2 = ABAC.ID("./newGuy.pem") |
---|
| 20 | |
---|
| 21 | try: |
---|
| 22 | f = open("./newGuy.pem") |
---|
| 23 | id3 = ABAC.ID_chunk(f.read()) |
---|
| 24 | f.close() |
---|
| 25 | except: |
---|
| 26 | pass |
---|
| 27 | |
---|
| 28 | try: |
---|
| 29 | f = open("./newGuy.pem") |
---|
| 30 | id4 = ABAC.ID_chunk(f.read()) |
---|
| 31 | f.seek(0,0) |
---|
| 32 | id4.load_privkey_chunk(f.read()) |
---|
| 33 | f.close() |
---|
| 34 | except: |
---|
| 35 | pass |
---|
| 36 | |
---|
[bec30b5] | 37 | id5 = ABAC.ID("./oldGuy.pem") |
---|
| 38 | |
---|
| 39 | ## can not test out this, |
---|
| 40 | #id6 = ABAC.ID("./oldGuy.pem") |
---|
| 41 | #id6.load_privkey("./newGuy.pem") |
---|
| 42 | #id7 = ABAC.ID("./oldGuy.pem") |
---|
| 43 | #id7.load_privkey("./oldGuy.pem") |
---|
| 44 | |
---|
[a02c849] | 45 | print "id has privkey %d" % id.has_privkey() |
---|
| 46 | print "id1 has privkey %d" % id1.has_privkey() |
---|
| 47 | print "id2 has privkey %d" % id2.has_privkey() |
---|
| 48 | print "id3 has privkey %d" % id3.has_privkey() |
---|
| 49 | print "id4 has privkey %d" % id4.has_privkey() |
---|
| 50 | |
---|
[bec30b5] | 51 | print "id5 has privkey %d" % id5.has_privkey() |
---|
| 52 | #print "id6 has privkey %d" % id6.has_privkey() |
---|
| 53 | #print "id7 has privkey %d" % id7.has_privkey() |
---|
Note: See
TracBrowser
for help on using the repository browser.