abac0-leakabac0-meicompt_changesgec13mei-idmei-rt0-nmei_rt0mei_rt2mei_rt2_fix_1meiyap-rt1meiyap1rt2tvf-new-xml
Last change
on this file since b04404d was
adc86c3,
checked in by Mike Ryan <mikeryan@…>, 13 years ago
|
fetch the issuer from an attribute/ID cert
see #17
|
-
Property mode set to
100644
|
File size:
778 bytes
|
Line | |
---|
1 | #include <creddy.h> |
---|
2 | |
---|
3 | #include "creddy_common.h" |
---|
4 | |
---|
5 | void issuer_main(options_t *opts) { |
---|
6 | if (opts->cert == NULL) |
---|
7 | usage(opts); |
---|
8 | |
---|
9 | // first try ID cert |
---|
10 | creddy_id_t *id = creddy_id_from_file(opts->cert); |
---|
11 | if (id != NULL) { |
---|
12 | char *issuer = creddy_id_issuer(id); |
---|
13 | |
---|
14 | puts(creddy_id_issuer(id)); |
---|
15 | creddy_id_free(id); |
---|
16 | |
---|
17 | return; |
---|
18 | } |
---|
19 | |
---|
20 | // then try attribute cert |
---|
21 | certificate_t *ac = lib->creds->create(lib->creds, |
---|
22 | CRED_CERTIFICATE, CERT_X509_AC, |
---|
23 | BUILD_FROM_FILE, opts->cert, |
---|
24 | BUILD_END |
---|
25 | ); |
---|
26 | if (ac != NULL) { |
---|
27 | printf("%Y\n", ac->get_issuer(ac)); |
---|
28 | DESTROY_IF(ac); |
---|
29 | return; |
---|
30 | } |
---|
31 | |
---|
32 | // give up if neither works |
---|
33 | errx(1, "Couldn't load %s as an ID or attribute cert", opts->cert); |
---|
34 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.