abac0-leakabac0-meicompt_changesgec13mei-idmei-rt0-nmei_rt0mei_rt2mei_rt2_fix_1meiyap-rt1meiyap1rt2tvf-new-xml
Last change
on this file since a5a8234 was
04f5da1,
checked in by Mike Ryan <mikeryan@…>, 14 years ago
|
-lcreddy extracted
|
-
Property mode set to
100644
|
File size:
1.2 KB
|
Rev | Line | |
---|
[04f5da1] | 1 | #include <creddy.h> |
---|
| 2 | |
---|
| 3 | #include "creddy_common.h" |
---|
| 4 | |
---|
| 5 | // ugh, this needs to go away |
---|
| 6 | // do so by replacing this with a call into libabac |
---|
| 7 | #include "libcreddy_common.h" |
---|
[784a398] | 8 | |
---|
| 9 | void verify_main(options_t *opts) { |
---|
| 10 | certificate_t *subject_cert = NULL; |
---|
| 11 | |
---|
| 12 | if (opts->cert == NULL) |
---|
| 13 | usage(opts); |
---|
| 14 | |
---|
[592f3e2] | 15 | creddy_id_t *issuer = creddy_id_from_file(opts->cert); |
---|
| 16 | if (issuer == NULL) |
---|
| 17 | errx(1, "Can't load issuer cert from %s", opts->cert); |
---|
[04f5da1] | 18 | certificate_t *cert = creddy_id_cert(issuer); // replace this with a call into libabac |
---|
[784a398] | 19 | |
---|
| 20 | if (opts->attrcert != NULL) |
---|
| 21 | subject_cert = attr_cert_from_file(opts->attrcert); |
---|
| 22 | else |
---|
| 23 | subject_cert = cert; |
---|
| 24 | |
---|
| 25 | int good = 0; |
---|
| 26 | if (subject_cert->issued_by(subject_cert, cert)) |
---|
| 27 | if (subject_cert->get_validity(subject_cert, NULL, NULL, NULL)) |
---|
| 28 | if (cert->get_validity(cert, NULL, NULL, NULL)) { |
---|
| 29 | puts("signature good, certificates valid"); |
---|
| 30 | good = 1; |
---|
| 31 | } |
---|
| 32 | else |
---|
| 33 | puts("signature good, issuer cert not valid now"); |
---|
| 34 | else |
---|
| 35 | puts("certificate not valid now"); |
---|
| 36 | else |
---|
| 37 | puts("signature invalid"); |
---|
| 38 | |
---|
| 39 | if (subject_cert != cert) |
---|
| 40 | DESTROY_IF(subject_cert); |
---|
[592f3e2] | 41 | creddy_id_free(issuer); |
---|
[784a398] | 42 | |
---|
| 43 | exit(good); |
---|
| 44 | } |
---|
Note: See
TracBrowser
for help on using the repository browser.