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