source:
examples/example_scripts/python/abac_keyid.py
@
7751094
Last change on this file since 7751094 was bea18ef, checked in by , 12 years ago | |
---|---|
|
|
File size: 588 bytes |
Rev | Line | |
---|---|---|
[ba6027a] | 1 | #!/usr/bin/env python |
2 | ||
[bea18ef] | 3 | """ |
[ba6027a] | 4 | abac_keyid.py |
5 | ||
[bea18ef] | 6 | To demonstrate how to use ABAC's api in python to access keyid of a |
[ba6027a] | 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 | ||
[bea18ef] | 14 | """ |
[ba6027a] | 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 | except Exception, e: | |
28 | print "Problem loading cert: %s" % e | |
29 | exit(1) | |
30 | ||
31 | print id.id_keyid() |
Note: See TracBrowser
for help on using the repository browser.