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