abac0-leakabac0-meimei-idmei-rt0-nmei_rt0tvf-new-xml
Last change
on this file since 4e10a0f was
4721618,
checked in by Mei <mei@…>, 12 years ago
|
1) tested out python and perl test scripts along with
abac_chunk_t calls in libabac's abac.hh
|
-
Property mode set to
100755
|
File size:
629 bytes
|
Rev | Line | |
---|
[4721618] | 1 | #!/usr/bin/env python |
---|
| 2 | |
---|
| 3 | """ |
---|
| 4 | abac_keyid2.py |
---|
| 5 | |
---|
| 6 | To demonstrate how to use ABAC's api in python to access keyid of a |
---|
| 7 | principal credential |
---|
| 8 | |
---|
| 9 | pre-condition: generate IceCream_ID.pem and IceCream_private.pem with |
---|
| 10 | creddy --generate --cn IceCream |
---|
| 11 | |
---|
| 12 | keyid of the loaded principal credential is printed |
---|
| 13 | |
---|
| 14 | """ |
---|
| 15 | |
---|
| 16 | from sys import argv, exit |
---|
| 17 | from ABAC import ID |
---|
| 18 | |
---|
| 19 | if len(argv) < 2: |
---|
| 20 | print "Usage: abac_keyid.py <cert.pem>" |
---|
| 21 | exit(1) |
---|
| 22 | |
---|
| 23 | id = None |
---|
| 24 | try: |
---|
| 25 | print argv[1] |
---|
| 26 | id = ID(argv[1]) |
---|
| 27 | id.load_privkey(argv[2]) |
---|
| 28 | except Exception, e: |
---|
| 29 | print "Problem loading cert: %s" % e |
---|
| 30 | exit(1) |
---|
| 31 | |
---|
| 32 | print id.keyid() |
---|
| 33 | print 'okay' |
---|
| 34 | |
---|
Note: See
TracBrowser
for help on using the repository browser.